President Trump said Thursday that his cancellation of the much-ballyhooed summit with North Korean dictator Kim Jong Un next month was “a tremendous setback” for the rogue regime.

“I believe that this is a tremendous setback for North Korea and, indeed, a setback for the world,” the president said in brief remarks from the White House.

And he issued a blunt warning that the US and its Asian allies were ready to respond if the North were to take military action.

“I’ve spoken to [Defense Secretary] General [James] Mattis and the Joint Chiefs of Staff and our military, which is by far the most powerful anywhere in the world that has been greatly enhanced recently, as you all know, is ready if necessary,” he said.

“Likewise, I have spoken to South Korea and Japan, and they are not only ready should foolish or reckless acts be taken by North Korea, but they are willing to shoulder much of the cost of any financial burden, any of the costs associated by the United States in operations if such an unfortunate situation is forced upon us.”

Trump also said that tough sanctions would remain in place — but left the door open to rescheduling the summit.

“If and when Kim Jong Un chooses to engage in constructive dialogue and actions, I am waiting,” he said.

The president paired his tough talk about military action with words of praise for the leader he had often mocked as “Little Rocket Man.”

“They want to do what’s right. I really believe Kim Jong Un wants to do what’s right, so hopefully things will work out,” he said in response to reporters’ questions.

“We have a wonderful, there’s been a very good working relationship. It started with the hostages coming back home. The hostages came home, we didn’t have to pay, we wouldn’t have paid, but they came back home. They’re now safely ensconced in their houses and they’re very happy and thrilled, and they never thought it was going to happen,” Trump said.

The chances for rescheduling the summit and reaching agreement with the North remained good, he added.

“The dialogue was good until recently. I really believe we have a great opportunity. We’ll see whether or not that opportunity is seized by North Korea. If it is, great for them and great for the world. If it isn’t, it will be just fine,” he said.

Trump earlier Thursday abruptly canceled next month’s summit with Kim in a letter citing the “tremendous anger and open hostility” in a recent statement by the North that called Vice President Mike Pence a “political dummy.”

Trump said in the letter to Kim released by the White House that, based on the statement, he felt it was “inappropriate, at this time, to have this long-planned meeting.”

Adding his own threat, he said that while the North Koreans talk about their nuclear capabilities, “ours are so massive and powerful that I pray to God they will never have to be used,” a remark reminiscent of his boast that his nuclear button was bigger than Kim’s.

The abrupt cancellation of the June 12 meeting for now gets the US out of an unprecedented summit that offered the prospect of a historic nuclear peace treaty — or an epic diplomatic failure.

No sitting American president has ever met with a North Korea leader — and Trump agreed to the sit-down with scant input from the administration’s national security and foreign policy teams.

In the North Korean statement that Trump cited, a top Foreign Ministry official called Pence a “political dummy” for his comments on the North, and said it was up to the US whether they would “meet us at a meeting room or encounter us at nuclear-to-nuclear showdown.”

Trump — who had earlier praised murderous dictator Kim as “honorable” — said the world was losing a “great opportunity for lasting peace and great prosperity and wealth.”

But he left the door open to the chance that the summit could be rescheduled.

“If you change your mind having to do with this most important summit, please do not hesitate to call me or write,” he wrote in unusually personal language for a diplomatic communication with the head of an enemy state.

Secretary of State Mike Pompeo, testifying on Capitol Hill, said North Korea had not responded to repeated requests from US officials to discuss logistics for the summit.

He told the Senate Foreign Relations Committee that the lack of responses was an additional reason for Trump’s decision.

Pompeo said the North’s attitude had changed markedly since he returned from a trip to Pyongyang earlier this month during which he met with Kim and oversaw the release of three Americans being held there.

Pompeo had said a day earlier that he expected the summit to take place as scheduled.

The cancellation came shortly after Kim made good on his promise to demolish his country’s nuclear test site, which was formally closed in a series of huge explosions Thursday as a group of foreign journalists looked on.

The explosions at the test site deep in the mountains of the North’s sparsely populated northeast were supposed to build confidence ahead of the summit.

But the closing of the site was not an irreversible move and would need to be followed by many more significant measures to meet the demand for real denuclearization.

The president had agreed to the historic sit-down in March after months of trading insults and nuclear threats with the North Korean leader.

But after criticism from Pyongyang, Trump cast doubt this week on whether the meeting would happen.

White House officials had privately predicted for weeks that the summit could be canceled once or twice before actually taking place, owing to the hard-nosed style of the two leaders.

Trump has seemed to welcome chatter about a Nobel Peace Prize — claiming that “everyone” thought he should get the coveted award.

The commander-in-chief’s allies in Congress predictably applauded the president’s move, saying he was justified in pulling out.

“North Korea has a long history of demanding concessions merely to negotiate. While past administrations of both parties have fallen for this ruse, I commend the president for seeing through Kim Jong Un’s fraud,” said Arkansas GOP Sen. Tom Cotton.

Critics were less impressed.

New York Rep. Eliot Engel, the top Democrat on the Foreign Affairs Committee, called the development “another embarrassment for the country,” adding: “This is not ‘Ding Dong School.’ It’s serious.”