Speaking in Makka, the Muslim holy city in western Saudi Arabia, where he was attending an Islamic summit, Ahmadinejad said Iran's right to develop a full civilian nuclear programme was non-negotiable.
"We are not allowed to negotiate on the principle of having peaceful nuclear technology," Iran's official IRNA news agency quoted him as telling a news conference.
Iran has cold-shouldered an offer by the EU3 powers - Britain, France and Germany - to resume dialogue this month based on Russia's proposal to process Iranian uranium as a joint venture to minimise the risk of bomb-making by Tehran.
The Islamic republic says its nuclear project aims only to produce electricity, not weapons as the West suspects.
"You are telling us we can't produce nuclear fuel, that we will give it to you. You who imposed medical embargoes on nations that caused the death of countless numbers of people, what guarantees are there that you will give us nuclear fuel?" Ahmadinejad said.
The Iranian president was just one of dozens of Muslim leaders from across the globe who agreed on Thursday on measures to combat terrorism and defend the image of Islam at the Makka gathering.
The leaders wound up a two-day summit of the Organisation of the Islamic Conference (OIC) pledging to "update national laws to criminalise all acts of terrorism as well as its financing and incitement".
In a Makka Declaration read out in a final session, they also called upon their peoples to "combat forcefully the preachers of sedition and deviation, who aim to distort the peaceful principles of Islam".
The Makka summit called for an
end to terrorism and extremism
Saudi Foreign Minister Saud al-Faisal said late on Wednesday that Muslim leaders who met in Makka had agreed to "combat terrorism and extremism and stressed the moderate nature of Islam".
They stressed the need to stop blaming outside forces for problems in the Muslim world and focus on cooperation, he said.
"Islamic unity would not be reached through bloodshed as claimed by the deviants," said King Abdullah, whose country hosts the headquarters of the 57-member OIC.
King Abdullah was referring to Muslim fighters, notably al-Qaida network of Saudi-born Osama bin Ladin which has claimed attacks across the globe, including in Saudi Arabia.
He called on the Islamic jurisprudence arm of the OIC to "fulfil its historic role of combating extremism".
He also called for a reform of educational programmes in Muslim states, which are facing US pressure to change school textbooks that Washington has criticised as intolerant.