President Trump said Wednesday that the United States would have gotten into a war with North Korea costing “millions” of lives if he weren’t in the White House.

“You are going to have a war if I wasn’t elected, you would be in a war,” Trump told reporters in New York — where he’s in town for the United Nations General Assembly — during a wide-ranging press conference.

“President Obama essentially said the same thing. He was ready to go to war. You would have had a war and you would have lost millions, not thousands, you would have lost millions of people.

“You know how close he was to pressing the trigger for war? Millions of people. With me, nobody is talking about that. Nobody is talking about that. We have a very good relationship.”

The president also patted himself on the back for saving “millions” of lives in Syria’s war-torn Idlib province when he convinced Russian and Iranian forces not to carpet bomb a section of Syria where terrorists are believed to be hiding.

“They were going to drop bombs all over the place and perhaps kill millions of people in order to get 35,000 terrorists,” Trump said.

“I put it out on social media and elsewhere. I gave [Secretary of State] Mike Pompeo, [National Security Adviser] John Bolton — everybody — these orders: ‘Don’t let it happen.’ I said, ‘Don’t let it happen.’ ”

He also claimed the UN General Assembly was laughing with him when the body burst into guffaws Tuesday when he boasted his administration “has accomplished more than almost any administration in the history of our country in its first two years.”

“They weren’t laughing at me, they were laughing with me,” he said. “We had fun. That was not laughing at me.

“So, the fake news said, ‘People laughed at President Trump.’ They didn’t laugh at me. People had a good time with me. We were doing it together.”

Despite the trade war with China, Trump insisted that Beijing actually respects him, regardless of the tariffs imposed by his administration, because of his “very, very large brain.”

On another trade issue, Trump said he rejected a meeting with Canadian Prime Minister Justin Trudeau because he doesn’t like Canada’s trade representatives and their current offers.

He also threatened to tax cars coming into America from Canada, but stopped short of saying whether his tough talk toward Canada would spell the end of NAFTA.

Trump also went after the Federal Reserve for hiking interest rates — but then waved off the higher rates as a sign that the economy is doing well.

“Unfortunately, they just raised interest rates a little bit because we are doing so well,” he said. “I’m not happy about that. I’d rather pay down debt.”

It was the fifth time Trump went solo at the podium since he took office. The last appearance came in June after he met with North Korean dictator Kim Jong Un in Singapore.