"Iran's missile power is not negotiable at any level under any pretext," Rouhani told Yukiya Amano, the director-general of the International Atomic Energy Agency, the official IRNA news service reported.
The president added, however, that Iran is prepared to cooperate with the IAEA's probe into whether its civilian nuclear program has a military component, "since there is no room for using a weapon of mass destruction in Iran's defense doctrine."
Western nations have long suspected Iran of covertly seeking a nuclear weapons capability, accusations denied by Tehran, which insists its nuclear program is only for civilian purposes like power generation and the production of medical isotopes.
Iran's long-range missile program is of major concern for Israel, which fears it may one day mount nuclear warheads on the projectiles and has not ruled out military action to prevent that from happening. Iran insists the missile program is a vital deterrent to a possible Israeli attack.
"We only accept those legal inspections by the agency that are in the framework of the Non-Proliferation Treaty and safeguards," Rouhani was quoted as saying. "Any inspection beyond the legal framework will harm entire developing countries."
Amano's visit comes as world powers continue to negotiate with the Islamic Republic in hopes of reaching a permanent deal to curb its nuclear ambitions in exchange for the lifting of crippling international sanctions.
The IAEA is trying to investigate allegations that Iran secretly worked on nuclear weapons -- something Tehran denies. The U.S. and its allies insist that any overall nuclear agreement with the Islamic Republic must include a conclusion by the agency that Iran has fully cooperated with its probe.
Amano also met Iran's Foreign Minister Mohammad Javad Zarif and the head of its nuclear agency, Ali Akbar Salehi, who said the two discussed exploding bridge wire detonators, which can be used to set off nuclear bombs but also have civilian industrial applications.
"Our colleagues today answered all questions on this," Salehi was quoted by IRNA as saying. He added that he hoped Amano would "take important steps on the issue and close the case, which is being finalized."
An IAEA report in May said Iran provided information and explanations that "the simultaneous firing of EBW was tested for civilian applications."
During his meeting with Rouhani on Sunday, Amano was quoted by IRNA as saying "the trend of the talks with Iran over the past year has been progressive and positive."
He added, however, that the agency was concerned about the slow pace of the nuclear talks, saying he hoped the outstanding issues could be settled in a "logical time span."