He faces five opponents, chief among them hard-liner Ebrahim Raisi, a close ally of Khamenei.
In Friday's debate, Tehran's mayor and presidential candidate Mohammad Bagher Qalibaf said that Rouhani and candidate Eshaq Jahangiri received "highly subsidized" properties from the government.
Rouhani's allies say the hardliners oppose deeper change and exposure to global competition in part because of the economic interests of the Guards, which gained control of swathes of Iran's industry during its years of isolation.
"You wanted to beat up students", Rouhani said. "We must increase direct aid to the poor", he added, accusing Rouhani's government of only boosting subsidies at the last minute to grab votes.
Seeking a second four-year term, moderate President Hassan Rouhani has been on the offensive all week, framing the vote as a choice between greater social freedoms and repression. The first round is on May 19, with a run-off a week later if no candidate wins more than 50 percent of the vote. In return, Iran agreed to limit its uranium production, curbing its nuclear program.
"Poverty has increased with this government from 23 percent to 33 percent", said Raisi, a cleric and jurist, who is seen as the leading conservative, though still a distant second to Rouhani in unofficial polls.
Khamenei made the remarks at the graduation ceremony of the cadets at Imam Hussein University affiliated with the Islamic Revolution Guards Corps (IRGC) in Tehran on May 10.
Meanwhile, local news outlets in Tehran reported that windows of one of Rouhani's campaign offices were smashed.
O'Reilly speaks out, anti-Fox News activist efforts continue
I don't know all the details-I don't want all the details, but I do know one of the sexual harassment suits was real simple. He said he will tell everyone who targeted him "soon" and might even take legal action.
Rouhani faced bruising attacks throughout the debate from his conservative opponents, who say his policies have done little to help the poor. "There is no evidence that the U.S. and the Western countries are abiding by their commitments", Raisi told an Iranian-backed news agency in Lebanon in a report released today.
He warned that enemies of Iran seek "to create tension and sedition to disrupt order and security".
"The security of the country must be completely preserved during the election", Khamenei said in the speech, which was delivered to an audience that included top commanders from the Revolutionary Guards, the most powerful military and economic force in the country.
As they look back on the violence that followed Iran's disputed 2009 election, authorities are fearful of a repetition, and want to avoid the ferocity of the peoples' dissent.
Mahmoud Alavi, Iran's Intelligence Minister, said in an interview aired Tuesday night, that his agents broke up a plot that involved gangs of youths paid to fight each other.
Alavi also said the ministry detained suspected members of an Iranian opposition exile group, although no further information was provided.
Candidates must manage their campaigns "in a way that protects national solidarity and integrity while not damaging ethics and values of the society", Alavi said.