WASHINGTON — A remarkable clash between two key American allies in the Middle East burst into the open here on Wednesday as the Iraqi prime minister publicly criticized the Saudi air campaign in Yemen and a top Saudi official retorted that there was “no logic to those remarks.”

The exchange, driven by sharply opposing views of Iran in the region, reflected the challenges facing the Obama administration as it tries to hold together a diverse coalition, including Sunni Arab states and Shiite-dominated Iraq, in the fight against the Islamic State, also known as ISIS. Iran is a sometimes patron to Iraq but an ideological archrival to Saudi Arabia.

The United States remains caught in a difficult balancing act as it tries to keep the Saudi air campaign in Yemen on track against Iranian-backed Houthis. But in its fight against the Islamic State in Iraq, the Obama administration finds itself supporting an Iraqi military offensive that is also backed by Iran.

The dueling Iraqi and Saudi narratives began when Prime Minister Haider al-Abadi of Iraq, who this week is making his first official visit to Washington, spoke early in the day to a small group of reporters at Blair House, the White House guest residence for visiting dignitaries. He said the Saudi campaign and the fighting in Yemen had created huge humanitarian problems.