Iraqi officials said the attacks were not related to the state visit by Ahmadinejad, the first by a regional leader since the U.S.-led invasion to topple Iran's old foe Saddam Hussein in 2003.
In the worst incident, at least 12 people were killed and 46 wounded when an Iraqi army patrol was hit by a bomb in a parked car in central Baghdad's Bab al-Muadham area, police said.
Another four people were killed and 10 wounded when a suicide bomber rammed a minibus into an Iraqi army checkpoint in Ghadeer in eastern Baghdad.
The U.S. military said Iraqi soldiers had prevented the bomber from reaching the probable intended target, a nearby Iraqi army headquarters, likely saving many lives.
"A minibus laden with explosives was stopped by the heroic actions of several Iraqi army soldiers," said U.S. military spokesman Colonel Allen Batschelet.
"Without a doubt, had the suicide bomber reached his target, more lives would have been lost."
Two soldiers were among the dead in the blast, which destroyed three houses and set several cars ablaze.
Elsewhere, police said a roadside bomb in northern Baghdad's Waziriya district wounded three civilians.
The bombings occurred despite a major security operation across Baghdad for Ahmadinejad's visit.
Iraqi security forces have sealed off two bridges near President Jalal Talabani's palatial home, where Ahmadinejad stayed overnight and where he has held talks with Talabani and other Iraqi leaders.
Many roads have also been closed, preventing some Baghdadis from getting to work.
"These are regular attacks. It has nothing to do with the visit of the Iranian president," said Major-General Qassim Moussawi, spokesman for security operations in Baghdad.
"If the suicide bomber wants to commit suicide, how can we prevent them?" he said.
U.S. officials in Baghdad say they will play no role in Ahmadinejad's visit and that the U.S. military will not be involved in protecting him unless it is asked for help.
IMPROVED SECURITY
Iraqi and U.S. military commanders blame Sunni Islamist al Qaeda for most large-scale bombings in Iraq but there was no immediate indication of who was responsible for Monday's blasts.
U.S. and Iraqi officials have hailed improved security in the capital and across the country in recent months, with attacks down by 60 percent since last June, when an extra 30,000 U.S. troops became fully deployed.
They also pointed to last week's policing of Arbain, one of Shi'ite Islam's most important annual rites which attracted some 7 million pilgrims, as an indication of how Iraqi security forces are able to handle major events.
About 40,000 Iraqi police and soldiers threw a security net over the Arbain ritual in southern Kerbala. However 63 pilgrims were killed on their way to Kerbala in the lead-up to the event in a bombing blamed on al Qaeda.
Iraqi government figures last week showed that violent civilian deaths had risen by 36 percent in February on the previous month after a series of large-scale suicide bombings blamed on al Qaeda.
Ahmadinejad was due to complete his visit by overseeing the signing of a series of agreements to strengthen economic ties with Iraq.
Iraqi officials said up to 10 bilateral accords would be signed before Ahmadinejad wraps up the first visit by an Iranian president to Iraq since Saddam launched an eight-year war on Iran in 1980 in which 1 million people died.