The United States, which believes Iran is trying to build an atomic bomb, has said it wants a diplomatic solution to end the row over Tehran's nuclear ambitions but has not ruled out military action if that route fails.