London's Mayor Sadiq Khan has slammed US President Donald for using "xenophobia, racism and 'otherness' as an electoral tactic" and labelled him "one of the most egregious examples of a growing global threat" - just hours before the president's first state visit to the UK.

Mr Khan, who has been an outspoken critic of Mr Trump, compared the president to European dictators of the 1930s and 40s, military juntas of the 1970s and 80s, Russian President Vladimir Putin and North Korean leader Kim Jong-un in a strongly-worded opinion piece published in The Observer on Sunday.

PA Wire

"It's so un-British to be rolling out the red carpet this week for a formal state visit for a president whose divisive behaviour flies in the face of the ideals America was founded upon – equality, liberty and religious freedom," he wrote.

Mr Trump is set to arrive in London on Monday for a three-day visit, where he will dine the British royal family at Buckingham Palace and later meet with outgoing Prime Minister Theresa May, days before she steps down as Conservative Party leader.

But the US president has already sparked controversy ahead of the visit, reportedly calling the Duchess of Sussex "nasty" and expressing support for Boris Johnson to replace Ms May.

READ MORE Trump calls Meghan 'nasty' on UK visit eve

"I think Boris would do a very good job. I think he would be excellent," he said in an interview with The Sun.

Mr Khan, the first Muslim to be elected Mayor of London, called on Ms May and other UK leaders to "issue a powerful rejection" of "Trump and the far-right agenda he embodies".

"At what point should we stop appeasing – and implicitly condoning – his far-right policies and views? Where do we draw the line," he wrote.

AAP

It's not the first time Mr Khan has criticised the president.

In July 2018, Mr Khan hit back at Mr Trump's claims that he was doing a "bad job" on terrorism and crime, calling the claims "preposterous".

READ MORE Snarling 'Baby Trump' blimp flies over London

The statements came amid anti-Trump protests in London, which saw a six-metre blimp depicting Mr Trump as a baby flown above the city during an earlier Presidential visit to the country.

Mr Khan had given permission for the blimp to be flown and rejected suggestions that it showed a lack of respect.