The 5-kilometer Anzob tunnel is located on a highway that connects the Tajik capital to the city of Khujand.
Ahmadinejad is on a two-day visit to Tajikistan for talks on economic ties and regional security.
The Iranian and Tajik delegations on July 5 signed six cooperation agreements.
Rakhmonov said Iran, which is already involved in the construction of a hydroelectric power station, would build a second road tunnel in the south of the country.
RFE/RL's Tajik Service reports the two leaders also agreed to set up a joint Persian-speaking television channel that would also broadcast to neighboring Afghanistan.
The project is likely to be discussed when Afghan President Hamid Karzai joins Rakhmonov and Ahmadinejad for a planned trilateral summit later on July 26.
(with additional material from Avesta, Asia Plus)
MORE: To read coverage of the Dushanbe summit from RFE/RL's Tajik Service, click here.