Prominent reformist figures, such as Mir Hossein Mousavi who led the so-called Green Revolution protests after the disputed elections of 2009, remain under house arrest and have not been allowed to put themselves forward as candidates.
Rafsanjani, 78, a former confidant of the late founder of the Islamic republic, Ayatollah Ruhollah Khomeini, last stood in 2005 when he lost to Ahmadinejad.
While seen as a conservative, he was deemed to be a "pragmatist" who was willing to pursue political reform and reconciliation with the West. He also fell out with the Supreme Leader after criticising the crackdown on anti-government protests in 2009. His younger daughter, Faezeh, recently served a six-month prison sentence for her role in the disturbances that followed.
That he is now an enemy of the political establishment means he could have attracted many Green Revolution votes, as they have no candidate of their own.
It was claimed Rafsanjani had been barred from the contest on the grounds of his advanced age. But in a country whose power elite is dominated by elderly clerics few were convinced.
One powerful cleric, Ayatollah Mohieddin Haeri Shirazi, sent a letter to the supreme leader saying "omitting a prominent figure from the election was incompatible" with giving wide choices to voters, Iran's semi-official ISNA news agency reported.
The blocking of Mashaei's candidacy appears related to the Supreme Leader's parallel fallout with Ahmadinejad. While he originally backed Ahmadinejad's disputed 2005 electoral victory, he later concluded the President's populist style risked eclipsing his own authority.
The exclusion of Mashaei and Rafsanjani clears the way for pro-Khamenei candidates to dominate.