During the rallies, the participants chanted slogans against the Washington and Tel Aviv regimes, including "Down with the U.S.", and "Down with Israel".
Since Trump took office, the USA has repeatedly threatened to abandon the agreement.
Rouhani said the "ignorant, ugly, spiteful literature of the USA president, which was full of false information and groundless allegations, against the Iranian nation" were beneath the dignity of the United Nations.
Ayatollah Khamenei deemed US President Donald Trump's Tuesday remarks against Iran "contemptible, offensive, obtuse, hectic, and all around untrue", adding "those words were not said from a position of power, but out of anger, desperation and idiocy, since Americans are extremely upset that their old plans in the West Asian region have been thwarted due to the influential presence of the Islamic Republic of Iran".
The US president's comments were not a source of pride for the American nation, the Leader said, adding that the American elite should be ashamed of having such a president, as they have already done so.
"The foolish, very ugly, and ignoble speech of the United States president, with its gangster and cowboy language full of sheer lies, is rooted in their anger, frustration, and light-headedness", Ayatollah Khamenei said in a meeting with members of Iran's Assembly of Experts in Tehran on Thursday.
Senior Iranian cleric Kazem Seddiqi addresses worshippers during weekly Friday Prayers in Tehran on September 22, 2017.
Tensions between Tehran and Washington have increased under Trump's administration.
They condemned Trump's baseless accusations against Iran during his much-criticized speech at the United Nations General Assembly and vowed to fully defend the Iranian government and the Islamic Revolution.
Last week, Trump hinted that the United States might not recertify Iranian compliance with the nuclear agreement in October, adding that Tehran "violated the spirit of that deal".