The US has threatened to cut aid to Iraq if the new government includes politicians with a sectarian bias.
Khalilzad (right) raised the spectre of Afghan-style warlordism
US ambassador Zalmay Khalilzad was speaking after talks to form a new government faltered over divisions between Shias, Sunni Arabs and Kurds.
"Sectarian and ethnic conflict is the fundamental problem in Iraq," he said.
The ambassador said the US would not continue spending billions of dollars to build up security forces run by people with a sectarian agenda.
"American taxpayers expect their money to be spent properly. We are not going to invest the resources of the American people into forces run by people who are sectarian," he said at a rare news conference.
Mr Khalilzad bluntly warned politicians from Iraq's largest group, the Shia Muslims, that the key defence and interior ministries must be in the hands of people "who are non-sectarian, broadly acceptable and who are not tied to militias".
Sunni Arabs leaders accuse the Shia-led interior ministry of employing militias to oppress their civilians under the guise of fighting the insurgency.
Mainly-Sunni insurgents have launched tens of thousands of attacks on US forces, their allies and targets associated with the new regime established since the US overthrow of Saddam Hussein nearly three years ago.
Mr Khalilzad said it was time for Iraqis to heal sectarian and ethnic differences and form a government of national unity that is not dominated by Shia Muslims and Kurds.
"Iraq is going through a period of state and nation building.
"The insurgency and the terror that is part of the scene is a reflection of [sectarian] conflict," he said.
Shia leaders say they have the right to control key offices in the government after winning 130 of the 275 seats in parliament in a vote on 15 December.
Political leaders have yet to start serious talks on forming a new government and correspondents say negotiations full of sectarian obstacles could last for months.
Mr Khalilzad said the new defence and interior ministers and other key security officials must be "non-sectarian, broadly acceptable and... not tied to militias".
The government must "disband the militias, otherwise Iraq faces the risk of warlordism that Afghanistan went through for a period", he said.