Donald Trump has offered his backing to Boris Johnson, the frontrunner to become the UK’s prime minister next week, saying he will succeed in pushing through Brexit.

The US president, who has been heavily critical of Theresa May’s attempts to reach a withdrawal deal, has previously sought to align his own populist politics with the UK’s vote to leave the EU, for which Johnson was a leading campaigner.

He said of Johnson on Friday: “I like him. I spoke to him yesterday. I think we’re going to have a great relationship.”

Trump also said May had “done a very bad job with Brexit”, adding: “It’s a disaster and it shouldn’t be that way. I think Boris will straighten it out.”

Johnson has been prominent among those facing questions over their willingness to stand up to Trump. Both he and Jeremy Hunt, his opponent in the race to succeed May, declined during a recent head-to-head debate to explicitly condemn as racist the president’s call for four American Congresswomen of colour to “go back home” to other countries.

It followed criticism of Johnson’s conduct in an earlier debate, when he repeatedly refused to back the UK’s ambassador to Washington, Sir Kim Darroch, who Trump had said he would no longer deal with.

Darroch had come under fire after leaked secret diplomatic cables revealed him referring to the president in unflattering terms. After Johnson failed to back him he announced his decision to resign.

Johnson later claimed Darroch had not seen the footage of him in the debate, but had heard a third-hand account and decided to resign from the UK’s most prestigious foreign posting without seeking any further information.

When asked about whether he would ever criticise Trump, Johnson has pointed to comments he made in 2015 while serving as London’s mayor about the then candidate for the White House.

Trump had said said some parts of London had become “so radicalised … that the police are afraid for their own lives”. In response, Johnson said Trump was “betraying a quite stupefying ignorance that makes him, frankly, unfit to hold the office of president of the United States”.

He added: “I would invite him to come and see the whole of London and take him round the city except that I wouldn’t want to expose Londoners to any unnecessary risk of meeting Donald Trump.”