Rouhani marked celebrations of the 38th anniversary of Iran's Islamic Revolution Friday by addressing thousands gathered in Tehran, many of whom have been angered by the travel ban imposed by US President Donald Trump.
Rouhani did not mention Trump by name but instead stated "some amateurs are holding reins of power" in a nearly hour-long speech.
"All of them must know when it comes to the nation of Iran, they must speak to this great nation with equal respect," he told the crowd.
"This great nation will stand resolute in the face of threats. Those who threaten our government, our administration and our armed forces, must know that our nation is a united nation, is an informed nation and, in the face of those who wish her harm, will stand steadfast up to the very end."
The unanimous ruling from a three-judge panel means that citizens of seven majority-Muslim countries including Iran will continue to be able to travel to the US, despite Trump's executive order last month.
At the Revolution Day march in Tehran, crowds carried placards that said "Death to America' and walked over American flags laid out in the streets. Others held posters thanking the US for standing up for Muslims.
Tensions between Iran and the US have risen since Trump assumed his role in the White House.
The travel ban, along with new US sanctions over an Iranian ballistic missile test, have contributed to the deteriorating relationship.
Concerns have also been raised over the future of a deal, brokered by the Obama administration, that requires Iran to heavily restrict its nuclear program.
Earlier this week, Iran's Supreme Leader Ayatollah Ali Khamenei stated he was grateful to Trump for showing "the true face of the US."
Khamenei told a gathering of Iran's air force commanders in Tehran that the new US administration had shown the world "the depth of corruption in US government," according to quotes published by Iran's semi-official MEHR news agency.
Khamenei reportedly told the commanders: "We however thank this new guy in the White House, since he largely did the job we had been trying to do in the past decades: to divulge the true face of the US. We had been working to show the world the depth of corruption in US government and ranks and files of the ruling elite; Trump did it in few days after coming to the White House."
In a reference to the travel ban, he added: "Their claims to human rights are no longer tenable."
Last Saturday, a day after the Trump administration announced fresh sanctions over the missile test, US Defense Secretary James Mattis called Iran "the single biggest state sponsor of terrorism in the world.
Two days earlier, Trump had tweeted that "Iran has been formally PUT ON NOTICE"
and should have been "thankful" for the "terrible deal" brokered by the Obama administration. He declined to rule out military action against Iran.
But a senior Iranian adviser to the Ayatollah, Ali Akbar Velayati, dismissed Trump's remarks as "baseless ranting." And this is not the first time that the Ayatollah has spoken in such terms about the US President.
In November, during the election race, Khamenei lambasted both Trump and Hillary Clinton for revealing what he called the moral shortcomings of the US.