​WASHINGTON — President Trump said other world leaders are asking with why the American media is “rooting” for the country “to fail” Sunday, following reports that he was blindsided by the French​ inviting a top Iranian official​ to the G-7 summit.

“The question I was asked most today by fellow World Leaders, who think the USA is doing so well and is stronger than ever before, happens to be, ‘Mr. President, why does the American media hate your Country so much? Why are they rooting for it to fail?’” Trump wrote on Twitter.

The tweet comes after media reports portrayed Trump as looking flat-footed when French President Emmanuel Macron surprised G-7 attendees by inviting Iranian Foreign Minister Mohammad Javad Zarif to appear on the sidelines of the summit​ ​in Biarritz, France.

When Trump was asked by reporters about Zarif’s rumored attendance, he replied: “no comment.”

Marcon’s invitation followed a tense Saturday night dinner in which the leaders discussed Iran’s nuclear program and whether to include Russian President Vladimir Putin in future meetings.

Trump has taken a tough ​stand on Iran, pulling out of the 2015 Iran nuclear agreement, while floating that he believed Putin should be invited to rejoin the G-7, which Russia was pushed out of after annexing Crimea.

On Sunday, Trump appeared to say he was having “second thoughts” about his ongoing trade war with China — before his press secretary, Stephanie Grisham, and other top administration officials said he was “misinterpreted.”

“This morning in the bilat with the UK, the president was asked if he had ‘any second thought on escalating the trade war with China.’ His answer has been greatly misinterpreted,” Grisham said. “His answer has been greatly misinterpreted. President Trump responded in an affirmative — because he regrets not raising the tariffs higher.”

White House economic adviser Larry Kudlow said the president “didn’t exactly hear the question,” despite reporters asking it in three different ways to ensure the president was understood correctly.

Before Zarif’s arrival, Kudlow said the G-7 meeting had so far been a success.

“My view was, the meeting this morning, in fact, the whole conference — including the unexpected luncheon between President Trump and President Macron — has gone very well, better than we thought, with a very positive vibe,” Kudlow said. “So I will go far and say, actually, it’s been a solid gathering.”