On February 3, President Mahmoud Ahmadinejad and parliament speaker Ali Larijani indulged in a verbal duel in the assembly during the impeachment of a minister which was broadcast live by state media.
"This is bad. This is wrong and against the law and sharia (Islamic law) and morals, and violates the rights of people," said Khamenei in remarks reported by state television on Saturday.
"One head of a branch (Ahmadinejad) uses an accusation that is unproven in court and accuses the other two branches -- parliament and the judiciary."
Khamenei, who has the final say on all key national affairs, was referring to the tense parliamentary session in which Ahmadinejad accused Larijani's influential political family of financial corruption.
The public squabble occurred against the backdrop of a parliamentary decision to impeach Ahmadinejad's labour minister for refusing to sack Tehran's ex-prosecutor Saeed Mortazavi as head of the wealthy social welfare organisation.
In that session, Ahmadinejad played a video recording which allegedly incriminates Fazel Larijani, a brother of the parliament speaker and judiciary chief Ayatollah Sadeq Larijani, who is a direct appointee of Khamenei.
Fazel is shown in the clip as allegedly trying to bribe Mortazavi in exchange for political support from the parliament and the judiciary.
Larijani in response charged that Ahmadinejad was impeding justice by shielding his inner circle from judicial investigation.
On Saturday Khamenei criticised Larijani's handling of the session, saying he had "gone too far in defending himself" against Ahmadinejad.
He criticised the impeachment itself as a "bad decision" since Ahmadinejad will leave office in the summer when his term is over.
Khamenei also criticised the judiciary for "inaction" against corruption.
His remarks come as Iran is struggling to fight banking and oil sanctions imposed by the West against its nuclear programme, which have led to serious economic and social difficulties.
"People need calmness, psychological and moral security in their lives," Khamenei said.
The rift between Ahmadinejad and parliament, dominated by conservatives and critical of his administration, first surfaced in April 2011 after he challenged a ruling by Khamenei.
Iran is gearing up for a presidential election on June 14 to elect a successor to Ahmadinejad, whose victory in 2009 sparked deadly street protests against the results which the opposition claimed were rigged.