Ahmadinejad, who was giving a speech to a select group at the university to mark the beginning of the academic year, ignored the chants of "death to the dictator" and continued with his speech on the merits of science and the pitfalls of Western-style democracy, witnesses said.
The protesters scuffled with hardline students who were chanting "thank you president" while police looked on from outside the university gates. The protesters dispersed after the car carrying Ahmadinejad left the campus.
Students were once the main power base of Iran's reform movement but have faced intense pressure in recent years from Ahmadinejad's hardline government, making anti-government protests rare.
The president faced a similar outburst during a speech last December when students at Amir Kabir Technical University called Ahmadinejad a dictator and set fire to his picture.
Hoping to avoid a similar disturbance Monday, organizers imposed tight security measures, checking the identity papers of all students entering the university and allowing only selected students into the hall. But the protesters were somehow able to gain entrance.
Iran's reform movement peaked in the late 1990s after former reformist president Mohammad Khatami was elected and his supporters swept parliament. But hardliners who control the judiciary, security forces and powerful unelected bodies in the government stymied attempts to ease social and political restrictions.
Numerous pro-reform newspapers were shut down, and since Ahmadinejad's election in 2005, those that remain have been muted in their criticism fearing closure.
At universities, pro-reform students have been marginalized, holding low-level meetings. They hold occasional demonstrations, usually to demand better school facilities or the release of detained colleagues. But pro-government student groups have grown more powerful.