Mehdi Karroubi said in a letter, made public on Monday, that a number of detainees had claimed that several women and men, arrested amid violent demonstrations, were repeatedly abused by their jailers.
"A number of detainees have said that some female detainees have been raped savagely," Karroubi said in the letter to Akbar Hashemi Rafsanjani, an influential religious leader and former president.
"Young boys held in detention have also been savagely raped," he said, adding they were suffering from depression and serious physical harm after the alleged attacks.
Karroubi, who came fourth in the June election, appealed to Rafsanjani to bring the matter to the attention of Ayatollah Ali Khamenei, Iran's supreme leader.
His claims came after some Iranian officials acknowledged that a number of those detained during a crackdown over the protests had been subjected to mistreatment in prison.
'Violations and carelessness'
The deaths of at least three people in custody have prompted Iran to jail the head of the Kahrizak detention centre.
Iran's prosecutor-general said that that there had been "violations and carelessness" at the prison, but he insisted that any deaths were caused by illness, not torture.
Prisoners "died of viral illness and not as a result of beating", he said, according to Iran's semi-official Fars news agency.
The son of a senior adviser to Mohsen Rezaie, a defeated conservative presidential candidate, died at Kahrizak in July.
After Mohsen Ruholamini's death, Kahrizak, which was built for jailing violators of Iran's vice laws, was ordered closed by Khamenei due to "lack of necessary standards".
Iran's official IRNA news agency reported Ghorban Ali Dorri Najafabadi, Iran's prosecutor general, as saying: "Unfortunately, negligence and carelessness by some officials caused the Kahrizak incident, which is not defendable."
"During early days, it is possible there were mistakes and mistreatment due to overcrowding in the prison."
Iran's opposition has said that it believes a number of young people rounded up and taken to the prison after protesting against the re-election of Mahmoud Ahmadinejad, the president, were tortured to death.
At least 26 people died in the post-poll unrest, described as Iran's biggest crisis since the 1979 Islamic revolution, and hundreds of opposition supporters were detained.
Iran is continuing with a mass trial of more than 100 prominent reformist figures, opposition activists and others accused of offenses ranging from rioting to spying and seeking to topple Iran's rulers.
The trial has included televised confessions that human rights groups have said they believe were extracted through pressure.