The Iranian visa request had at first been refused by the US Department of Homeland Security, which suspects Ahmadinejad participated in the hostage taking at the US embassy in Iran in 1979.
But State Department spokesman Sean McCormack said on Wednesday that the visa was finally issued in the Swiss capital, Bern, on Tuesday.
Switzerland has represented US interests in Tehran since the United States severed ties the day after the 1979 hostage taking started.
McCormack said that Ahmadinejad had at first been considered "ineligible" under the US Immigration Nationality Act because of the homeland security department's suspicions.
The law "applies when we have, 'reason to believe', that the visa applicant is within the scope of that broad provision covering a wide range of past and present activity that is supportive or in furtherance of terrorist activity", the spokesman said.
"At the State Department's request, the Department of Homeland Security waived this ineligibility to allow the Iranian president, as Iranian head of government, to attend the General Assembly and high-level summit," McCormack added.
The State Department spokesman stressed "there are still unresolved questions concerning his activities surrounding the taking of the American embassy in Tehran and his activities in that subsequent period in which American citizens were held for 444 days. We have not forgotten that."
On 4 November 1979, following Iran's Islamic revolution, a group of radical student followers of Ayat Allah Khomeini stormed the US embassy in Tehran and held 52 of its staff hostage for 444 days.
Ahmadinejad, 49, is a veteran of Iran's Revolutionary Guards who went on to become mayor of Tehran before his victory in his country's presidential election this year.
He has discounted any move to normalise relations with the United States.
While in New York for the UN's 60th anniversary general assembly and special summit, Ahmadinejad will be subject to a 40km travel restriction applied to all Iranians entering the United States for UN business, the spokesman said.