Mo Farah took some time to focus on marathons in 2018 but returned to the track in 2020
It would have been the 39-year-old's first full marathon since 2019.
The six-time world champion won the Big Half - a half-marathon race - in London earlier this month as part of his preparations.
Britain's Farah said it is "really disappointing" and that he has done everything he can to compete but "it hasn't proved enough".
"I've been training really hard over the past few months and I'd got myself back into good shape and was feeling pretty optimistic about being able to put in a good performance," said Farah.
"However, over the past 10 days I've been feeling pain and tightness in my right hip. I've had extensive physio and treatment and done everything I can to be on the start line but it hasn't improved enough to compete on Sunday."
He added that he is disappointed not to be racing in front of his home crowd and that he hopes to return to the race in April 2023.
Farah, whose highest London Marathon finish was third in 2018, has raced in three London Marathons and was a pacemaker at the elite-only event in 2020.
His time of two hours five minutes 11 seconds at the Chicago Marathon in 2018, which is his only marathon victory, is a British record.
Hugh Brasher, event director of the London Marathon, said: "We are so sorry that Mo is not fit to run on Sunday. We wish him a very speedy recovery and hope to see him running the 2023 London Marathon in April next year."
Farah returned to the track in 2020 after three years of focusing on the marathon but failed to qualify for last year's delayed Tokyo Olympics.
He was also surprisingly beaten by club runner Ellis Cross at the London 10,000 in May as he returned to competition after an 11-month absence.
Ethiopian Sisay Lemma, who won the 2021 edition of the race, and compatriot Kenenisa Bekele are among the favourites for the men's title.