Oil-rich Iran has been seeking a way out of an economic crisis with its currency losing value rapidly as concern has grown about sanctions after the USA backed out of a multilateral agreement with Iran in May.
Rouhani said the United States has been "encouraging Iran to violate the JCPOA".
Khamenei also voiced support for continued talks with Iran's European partners in the nuclear agreement who are preparing a package of economic measures to offset the USA pullout from the accord.
"The current U.S. president does not talk about war, however, there are credible information based on which he has attempted to force the U.S. Army to carry out military attack on Iran during the past year", Baqeri told a meeting.
The US is seeking to tighten the economic screws on Iran, abandoning a landmark 2015 nuclear deal and reimposing stringent sanctions.
Rouhani says conflict with Iran would be 'mother of all wars'
President Donald Trump announced Washington's exit from the 2015 nuclear deal on May 8 and said sanctions will be restored against Iran .
The endorsement by Khamenei, who has the last word on all major issues of state, is likely to discourage any open opposition to Rouhani's apparent threat.
"Although the current U.S. administration does not openly speak of a military threat (against Iran), over the past one and a half years, it has been trying to (convince) the United States army to launch a military invasion according to existing precise information", he added.
At the end of June, Rouhani said the regime would "bring America to its knees" and suggested that half of America's population is "ashamed of their government".
Originally Trump demanded all other countries to stop buying its crude by November but now he says the United States may grant waivers to some allies heavily particularly reliant on Iranian supplies.
"America should know that peace with Iran is the mother of all peace, and war with Iran is the mother of all wars", Rouhani said in published reports. He added that "according to precise information", Trump is "trying to persuade the US military to launch an invasion [of Iran]".
Former President Obama helped spearhead the worldwide agreement, which offered Tehran sanctions relief in exchange for curbs to its nuclear program.