President Trump on Thursday pointed the finger at Prime Minister Theresa May for the UK’s Brexit debacle, saying she ignored his advice on negotiating her nation’s departure from the European Union and made things worse.

“I would have done it much differently,” Trump told The Sun newspaper in an explosive interview just hours before rubbing elbows with the British leader at a lavish black-tie dinner at Blenheim Castle in Oxfordshire.

“I actually told Theresa May how to do it but she didn’t agree,” he said. “She didn’t listen to me. She wanted to go a different route. I would actually say that she probably went the opposite way. And that is fine. She should negotiate the best way she knows how. But it is too bad what is going on.”

The president went on to say May’s negotiating tactics may have wrecked any chance of striking a trade pact with the United States.

“If they do a deal like that, we would be dealing with the European Union instead of dealing with the UK, so it will probably kill the deal,” the president said.

“If they do that, then their trade deal with the US will probably not be made.”

Shortly after Trump’s comments were posted by The Sun, White House Press Secretary Sarah Huckabee Sanders insisted her boss holds his UK counterpart May in high esteem.

“The President likes and respects Prime Minister May very much. As he said in his interview with the Sun she ‘is a very good person’ and he ‘never said anything bad about her,’ ” Sanders said in a statement.

“He thought she was great on NATO today and is a really terrific person.”

UK voters approved a 2017 referendum to leave the EU, by a margin of 51.9 percent to 48.1 percent.

Then-President Obama in 2016 had also predicted a tough road for a US-UK trade deal. But Obama’s dire warning came from a polar-opposite view of Trump’s – that Brexit itself would be the impediment.

“And on that matter, for example, I think it’s fair to say that maybe some point down the line there might be a UK-US trade agreement, but it’s not going to happen any time soon because our focus is in negotiating with a big bloc, the European Union, to get a trade agreement done,” Obama said in a joint appearance in London with then-PM David Cameron.

“The UK is going to be in the back of the queue (in the event of a UK departure from the EU).”

Excerpts from Trump’s bombshell interview were published Thursday just as the president was scheduled to dine with May at the palace.

While the president said he liked May and considered her a “very good person,” he tossed fuel on already smoldering tensions over how the UK will pull out of the EU next year.

“The deal she is striking is a much ­different deal than the one the people voted on,” Trump said.

“[It] will definitely affect trade with the United States, unfortunately in a negative way,” he added, noting how the US already has “enough difficulty with the European Union.”

“We are cracking down right now on the European Union because they have not treated the United States fairly on trading.”

Adding to his extraordinary takedown of May, Trump praised Boris Johnson, who stepped down this week as foreign secretary over Brexit.

“I’m not pitting one against the other,” Trump said. “I’m just saying, I think he’d be a great prime minister.”

Trump planned to meet with May again Friday for lunch and the two were scheduled to hold a joint press conference.