Obama warned against a pre-emptive strike on Iran.
US President Barack Obama has said it would be unacceptable for Iran to have a nuclear weapon, but warned against a pre-emptive strike on the country.
Obama is due to meet Israeli Prime Minister Benjamin Netanyahu on Monday
He told The Atlantic magazine he was not bluffing by threatening US action if Iran built a weapon but that an early strike could win Iran sympathy.
Iran says its nuclear programme is purely peaceful, but Israel and the US suspect it of developing weapons.
There has been speculation that Israel might launch a pre-emptive strike.
Correspondents say Washington is deeply alarmed by reports that Israel might take unilateral military action as early as April.
In the interview, Mr Obama said he believed the Israeli government "recognizes that, as president of the United States, I don't bluff".
"I also don't, as a matter of sound policy, go around advertising exactly what our intentions are. But I think both the Iranian and the Israeli governments recognize that when the United States says it is unacceptable for Iran to have a nuclear weapon, we mean what we say."
Mr Obama re-iterated that "a military component" for dealing with Iran remained an option, as well as sanctions and diplomacy, but warned that a premature attack on Iran might be counterproductive.
"At a time when there is not a lot of sympathy for Iran and its only real ally [Syria] is on the ropes, do we want a distraction in which suddenly Iran can portray itself as a victim?"
Mr Obama is due to meet Israeli Prime Minister Benjamin Netanyahu in Washington on Monday.
The US president described his relationship with Mr Netanyahu - often depicted as frosty - as "very functional," despite the two leaders coming from different political traditions.
He said most of their differences were "tactical and not strategic".
Mr Obama was heckled on the issue of military action against Iran at a Democratic fundraising event in New York on Thursday evening.
An audience member shouted: "Use your leadership - no war in Iran."
Mr Obama responded, to cheers: "Nobody has announced a war young lady. You're jumping the gun a little bit there."
American officials are thought to be seeking to persuade Israel to give sanctions more time to work.
The US has recently tightened its sanctions against Iran, imposing sanctions on the country's central bank and against three oil companies that trade with Iran.
The European Union has also adopted an oil embargo against Iran.
The UN ratified four rounds of sanctions against Iran between 2006 and 2010 in reaction to its refusal to halt uranium enrichment and co-operate with the International Atomic Energy Association (IAEA).