Ahmadinejad is not allowed to run for a third term under the terms of Iran's constitution, the BBC said.
Rafsanjani, 78, and Mashaei both turned in their paperwork within minutes of Saturday's deadline.
The Washington Post said their registration altered the field for candidates, which had previously been made up of conservative allies of supreme Ayatollah Ali Khamenei.
Rafsanjani is likely to have the support of Iranian reformists while Mashaei will be a favorite among Ahmadinejad's camp.
Swim Week Miami Beach 2014 [PHOTOS]