Official IRNA news agency said about 500 people gathered outside the embassy in northeastern Tehran in a protest that had not been authorised by the authorities.
Media reported that two Iranian teenagers who had gone on pilgrimage to holy sites in Saudi Arabia had been sexually harassed by police at the Red Sea airport of Jeddah, as they prepared to return home.
The alleged incident occurred several days ago, media said without giving an exact date.
State television said Iran summoned the Saudi charge d'affaires to lodge an official complaint and demanded that the case be taken to the courts.
Deputy Foreign Minister Hassan Ghashghavi told the state broadcaster that the two Saudi police had been arrested.
Signup to our newsletter and follow us on Facebook and Twitter!
Outside the Saudi embassy, protesters chanted slogans hostile to the Sunni-ruled Gulf kingdom and demanded that authorities in Shiite majority Iran shut the diplomatic mission.
"Shame on you. Get off our soil," the protesters chanted as security forces ringed the embassy.
The protesters also demanded that the Saudi police involved in the alleged sexual harassment be punished.
Ties between Iran and Saudi Arabia are tense and this incident is expected to further strain relations between the two Middle East powers, who are already divided over the conflict in Syria.
Relations have worsened since a Saudi-led coalition launched last month an air campaign against Shiite rebels in Yemen, which Riyadh says are backed by Iran.
Tehran, which denies arming the Huthi rebels, has denounced the Saudi-led campaign, with supreme leader Ali Khamenei warning against what he called "criminal acts".
On Wednesday Saudi authorities said they had prevented a plane carrying 260 Iranian pilgrims from landing in the kingdom, saying the airline operators had not applied for a permit to enter Saudi Arabia.