Obama, who opposed the war from the start, and accuses McCain of wanting to prolong ‘failed’ US policies, told the New York Times on Wednesday he was considering an overseas trip after securing the Democratic nomination.
"Iraq would obviously be at the top of the list of stops," Obama told the paper, but declined McCain's offer of a joint trip, saying he wanted no part of a "political stunt."
McCain, an advocate of Bush's troop surge strategy who has made multiple visits to US troops and commanders, said Obama's possible visit to Iraq was "long overdue”.
"It's been 871 days since he was there," McCain told reporters in Beverly Hills during a campaign stop in California.
"I'm confident that when he goes he will then change his position on the conflict in Iraq, because he will see the success that has been achieved on the ground."
The Vietnam war veteran earlier lashed the first-term Illinois senator's qualifications to be commander-in-chief, saying Obama had only gone to Iraq once just over two years ago.
"This is about leadership and learning," the Republican said in Reno, Nevada.
McCain, who criticized early US post-war policy, hit out at Obama for failing to sit down in Iraq with US commander General David Petraeus, while offering talks with leaders of US foes like Iran.
And he took issue with Obama's criticisms of his own past trips to Iraq, which included one occasion when he walked through a Baghdad market with a heavy US security detail, and the Democrat's critique of the surge.
"That is a profound misunderstanding, a profound misunderstanding of what's happened in Iraq, and what's at stake in Iraq," McCain said.
"If we set a date for withdrawal, as Senator Obama wants to do, there will be chaos, there will be genocide, there will be increased Iranian influence there."
Obama says on the campaign trail he would end the Iraq war in 2009, and accuses the Iraqi government of failing to take advantage of the US escalation to make political progress.
His spokesman Bill Burton led a counter-attack: saying "it seems odd that Senator McCain, who bought the flawed rationale for war so readily, would be lecturing others on their depth of understanding about Iraq."
"Senator Obama challenged the president's rationale for the war from the start, warning that it would divert resources from Afghanistan and the pursuit of Al-Qaeda and mire us in an endless civil war," he said.
"Senator McCain stubbornly insists on pursuing the failed Bush policy that continues to cost so much, while Senator Obama believes it's time to begin a deliberate, careful strategy to remove our troops and compel the Iraqis to take responsibility for their own future."
Obama's Democratic rival Hillary Clinton meanwhile launched an 11th hour bid to deprive him of the nomination, only five days before the final voting clashes.
Clinton wrote to nearly 800 top party officials or superdelegates to try to persuade them she was more likely to beat McCain in November's general election.
Her offensive came ahead of voting in Puerto Rico on Sunday and Montana and South Dakota on Tuesday, and despite Obama's lead in key measures of the race - elected delegates, super delegates, and nominating contests won.
"I believe I am best prepared to lead this country as president, and best prepared to put together a broad coalition of voters to break the lock Republicans have had on the electoral map and beat Senator McCain," she wrote.
Her campaign argued she will emerge from the gruelling nominating struggle leading the popular vote, with polls showing her the strongest Democrat to take on McCain.
But Obama's campaign manager David Plouffe said a simple tally of votes was immaterial.
"We do not think the popular vote is a true metric of the race - it is about delegates," Plouffe said, while disputing Clinton's arithmetic on the popular vote.
The new Clinton push came days ahead of Saturday's key meeting of a Democratic Party committee to discuss the voided primaries in Michigan and Florida, which had their delegates stripped over a scheduling dispute.