Mr. Johnson has promoted Brexit by saying it would open the door to a lucrative new deal with the United States — one that he would be well-placed to negotiate because of his warm relationship with Mr. Trump.

The president did not explain why Mr. Johnson’s deal with Brussels would hinder one with Washington. It apparently has to do with technical provisions known as Geographical Indications. Trade experts split on how much of a hurdle they pose, but the details mattered less than the theatrics.

As Mr. Johnson and Mr. Corbyn took to the campaign trail to begin framing their messages, Mr. Trump threw the spotlight on Mr. Farage, whose party could inflict damage on both Labour and Mr. Johnson’s Conservatives.

“I’d like to see you and Boris get together because you would have some real numbers,” Mr. Trump said to Mr. Farage, who has proposed aligning with the Conservatives but has been rebuffed by Mr. Johnson.

“I have enough to do over here without having to worry about the psychology of two brilliant people over there, frankly,” Mr. Trump added. “I wish you two guys could get together. I think it would be a great thing.”

Mr. Trump saved most of his vitriol for Mr. Corbyn, who has painted the president as a predatory rival, eager to use trade negotiations to gain access for American companies to Britain’s National Health Service.

“He’d be so bad, he’d take you in such a bad way,” Mr. Trump said, “He’d take you into such bad places.” Noting that he had never met Mr. Corbyn, he added, “I’m sure he’s a lovely man, but he’s of a different persuasion.”