President Trump on Friday fired back at Iran’s Ayatollah Ali Khamenei — who earlier in the day called him “a clown” — with a tweet warning that he had better “be very careful” when choosing his words.

“The so-called ‘Supreme Leader’ of Iran, who has not been so Supreme lately, had some nasty things to say about the United States and Europe. Their economy is crashing, and their people are suffering. He should be very careful with his words!” the commander in chief wrote on his way to a weekend at his Mar-a-Lago resort in Florida.

Khamenei described Trump as a “clown” who only pretended to support Iran’s people, and hailed the Islamic Republic’s recent missile attack on US troops in Iraq an “American humiliation.”

In his first Friday sermon in Tehran in eight years, the Ayatollah excoriated the US for its “cowardly” killing of top general Qassem Soleimani, who he said was the most effective commander in the battle against ISIS.

In response to the drone strike, Iran launched a barrage of ballistic missiles targeting two bases housing US troops in Iraq, without causing serious injuries.

“The fact that Iran has the power to give such a slap to a world power shows the hand of God,” Khamenei said, adding that the killing of Soleimani, commander of the Quds Force, showed Washington’s “terrorist nature.”

“The Quds Force is a humanitarian organization with human values that protects people across the region,” he said. “They are fighters without borders.”

Khamenei, who delivered part of his sermon in Arabic, said the strike had dealt a blow to America’s image as a superpower, adding that said the real punishment would be in forcing the US to withdraw from the Middle East.

“Resistance must continue until the region is completely freed from the enemy’s tyranny,” Khamenei said.

As Iran’s Revolutionary Guard braced for a US counterattack that never came, it mistakenly shot down a Ukrainian airliner shortly after it took off from Tehran, killing all 176 passengers on board, mostly Iranians.

“The plane crash was a bitter accident, it burned through our heart,” Khamenei said in an address punctuated by cries of “Death to America” from the masses.

“But some tried to… portray it in a way to forget the great martyrdom and sacrifice” of Soleimani, the head of the foreign operations arm of the Revolutionary Guards, he said, adding that the elite force can take its fight beyond Iran’s borders.

Iran initially denied its role in the tragedy, blaming the crash on a technical problem, but later admitted responsibility.

As a result, street protests erupted around the country, prompting security forces to disperse the crowds with live ammo and tear gas.

Trump sent tweets in Farsi and English to support the protesters, drawing a sharp response from Khamenei.

“These American clowns who lie and say they are with the Iranian people should see who the Iranian people are,” he said Friday.

Khamenei also lashed out at Britain, France and Germany, saying they are too weak to bring Iranians to their knees after they triggered a dispute mechanism to try and bring Iran back into compliance with the unraveling 2015 nuclear agreement.

“After the US exited the deal, I told you then that these countries cannot be trusted. Even their negotiations with Iran are full of deceit,” he said.

But, he added, he was still open to negotiation — just not with the US.

“The gentlemen behind the desks that negotiate are the same as the ones that terrorized Gen. Soleimani,” said Khamenei, 80, who openly wept at the funeral of the revered military commander.

Tensions between Tehran and the Washington have spiked since Trump withdrew the US from the nuclear deal with world powers, which had imposed restrictions on its nuclear program in exchange for the lifting of international sanctions.

After Soleimani was killed, Iran announced it would no longer be bound by the limitations in the agreement.

With Post wires