Boris Johnson has been condemned for referring to to Barack Obama as a "part-Kenyan president".
Obama arrived in London last night and has used his visit to encourage Britain to vote to remain a member of the European Union.
His long-expected intervention in the referendum has upset pro-Brext campaigners, including Johnson.
Writing in The Sun, the London mayor said the removal of a bust of Winston Churchill from the White House in 2008 showed he was uninterested in the UK-US relationship.
"Some said it was a snub to Britain. Some said it was a symbol of the part-Kenyan President’s ancestral dislike of the British empire – of which Churchill had been such a fervent defender," Johnson wrote.
Former Lib Dem leader Sir Menzies Campbell said: "Many people will find Boris Johnson's loaded attack on president Obama's sincerity deeply offensive. If this is an illustration of the kind of diplomacy that we might expect from a Johnson leadership of the Tory Party then heaven help us.
He added: "In truth this attack constitutes an unacceptable smear."
James McGory, the chief campaign spokesman for the 'Stronger In' pro-EU campaign said Johnson was guilty of "nasty, desperate stuff" for having a "pop" at Obama's ancestry.
The president was born in Hawaii. His father was born in Kenya.
Ukip leader Nigel Farage stoked further fury by claiming on the BBC's The World At One programme that Obama "bears a bit of a grudge against this country" because of his "grandfather and Kenya and colonialisation."
Sir Stephen Wall, former British Permanent Representative to the European Union, said: "Boris Johnson’s comment implying the President of the United States is driven by his ancestral dislike of the British empire is demeaning to the debate. Using that type of language does not reflect Britain’s standing in the world or the country we aspire to be.
"As our most important ally, President Obama has the right to offer his view and he has made it clear that being in Europe magnifies British influence and enhances Britain’s global leadership."
The claim Obama had the bust of Churchill removed from the White House has been questioned. The Washington Post has said there is "no evidence that Obama personally decided to return the bust" after his election.
Conservative MP Sir Nicholas Soames, the grandson of Winston Churchill, dismissed Johnson's argument. Using the bust to suggest Obama was anti-British was a "stupid irrelevant empty point," he added.
Writing in the Daily Telegraph, Obama said the US-UK special relationship which was “forged as we spilt blood together on the battlefield” is helped by Britain staying in the EU.
Invoking the wartime alliance, Obama added: “From the ashes of war, those who came before us had the foresight to create the international institutions and initiatives to sustain a prosperous peace: the United Nations and Nato; Bretton Woods, the Marshall Plan, and the European Union."
In his article, the president said "now is a time for friends and allies to stick together".
He added: “You should be proud that the EU has helped spread British values and practices – democracy, the rule of law, open markets – across the continent and to its periphery. The European Union doesn’t moderate British influence – it magnifies it.
“A strong Europe is not a threat to Britain’s global leadership; it enhances Britain’s global leadership. The United States sees how your powerful voice in Europe ensures that Europe takes a strong stance in the world, and keeps the EU open, outward looking, and closely linked to its allies on the other side of the Atlantic. So the US and the world need your outsized influence to continue – including within Europe.”
“The European Union doesn’t moderate British influence – it magnifies it”
"Today, we face tests to this order – terrorism and aggression; migration and economic headwinds – challenges that can only be met if the United States and the United Kingdom can rely on one another, on our special relationship, and on the partnerships that lead to progress."
Obama is due to hold a joint press conference with David Cameron in Downing Street on Friday afternoon.