Iran admitted for the first time Monday that a rocket exploded at the nation’s Imam Khomeini Space Center — a mishap that President Trump insisted last week was not caused by US involvement.

Iranian government spokesman Ali Rabiei confirmed that finding Monday, attributing the costly explosion to a technical mishap.

“This has been a technical matter and a technical error,” he said. “Our experts unanimously say so.”

The explosion, which came ahead of a planned satellite launch by Iran, was the third recent failure of a rocket at the space center, a streak of bad luck that had raised fears of sabotage in the nation’s space program.

To the consternation of Iranian officials, Trump last week tweeted an apparent spy-satellite photo of the aftermath in denying American involvement.

“The United States of America was not involved in the catastrophic accident during the final launch preparations for the Safir SLV Launch at Semnan Launch Site One in Iran,” wrote Trump. “I wish Iran best wishes and good luck in determining what happened at Site One.”

While the rocket was lost, Iran’s information and communications technology minister chided Trump with a tweet of his own, posting a selfie with the Nahid I satellite to show that it survived the blast unscathed.

“The explosion happened at the launchpad and no satellite had yet been transferred to the launchpad,” Rabiei confirmed Monday, adding his own dig at Trump.

“We don’t understand why the US president tweets and posts satellite pictures with excitement,” he said. “This is not understandable.”

The US has alleged that Iran’s satellite launch overtures violate a UN Security Council resolution calling on Tehran not to develop technology capable of delivering nuclear weapons.

With Post wires