The letter to Ayatollah Sadegh Larijani, head of the judiciary, was posted on Rouhani's website.
It came as the crisis between Tehran and Riyadh over the execution of a prominent Shia cleric showed little sign of abating.
Saudi-Iran tensions: Aziz fails to clear up ‘ambiguity’ in stance
Rouhani requested that the file involving those accused of setting fire to the embassy, as well as others detained after a similar attack on Saudi Arabia's consulate in the second city of Mashhad, be acted on immediately.
"Once and for all such assaults on the country's security, an insult to the establishment's authority and position, should be prevented by punishing perpetrators and those who ordered this blatant crime," said the letter.
The president, a moderate elected in 2013, condemned the violence early Sunday but his statement and the speedy arrests did not stop Saudi Arabia from severing diplomatic relations later that day.
Calling the incidents "totally unjustifiable", Rouhani has since been followed by numerous top officials and clerics who have also hit out at the attack for damaging Iran's reputation.
Khamenei’s website posts 'controversial' image comparing Saudi Arabia to Islamic State
Judicial officials have said the 50 people arrested include the alleged leaders of the attacks.
Longstanding tensions between Iran, the dominant Shia Muslim power in the Middle East, and Saudi Arabia, its Sunni rival, erupted into a full-blown row Saturday when Riyadh executed cleric Nimr al-Nimr.
Saudi authorities had previously accused Nimr, a leading figure among the kingdom's Shia minority, of stoking sedition.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ