Out of the fog of fighting between Iraq and Iran there emerges a clear American war aim. But it does not lie in taking a neutral position between the belligerents, and banking on the Russians and the United Nations to do the rest. On the contrary, this country's best interest would be served by the overthrow of the present Iranian government, and the establishment of a pro-Western regime in Tehran. Though the subject is delicate, some public discussion of potential risks and gains is useful, if only to define the true character of the Carter administration's position.

The first reason for favoring a new Iranian regime is that it would facilitate settlement of the war. Iraqi forces have made gains. Iraq is a small country of 12 million people. Iran is a vast country of 40 million people. Iraq cannot end the war by conquering Iran.

Neither can Iraq safely make a lasting peace with the regime of Ayatollah Khomeini. The ayatollah is a crusading imperialist for his own Shite brand if Islam.

Shiite Moslems make up more than half the population of Iraq. To President Saddem Hussein and the jother Sunni Moslems who run Iraq, the ayatollah is subversion incarnate. But while they cannot come to terms with him, they could easily make peace -- a generous peace -- with a secular Iranian leader.

Second, there is the Russian reason. The Soviets enjoy a political and military relationship with Iraq. They have a Communist Party presence in Iran and troops on the border. So Moscow has a foot in both camps. It can exploit that position to back a winner, or promote a settlement, or move into Iran if the country begins to disintegrate. Thus the war certifies Russia as the dominant power in the region.

But the establishment of a pro-Western government in Tehran would scotch all those Soviet opportunities. The Russians would be back where they were before the shah fell - secure, but not with almost irresistible opportunities to throw their weight around.

Regional stability provides a third reason. The present Iranian government asserts disruptive influence down the Persian Gulf to the Arabian Peninsula and the Mideast, and across the "northern tier" countries stretching east from Turkey through Pakistan to Afghanistan. While the ayatollah's regime persists, the states fringing Russia's southern border are up for grabs. Settlement between the Israelis and the Arabs is harder, and the stability of the oil sheikdoms, including Saudi Arabia, is menaced.

A pro-Western regime in Tehran would ease all those difficulties. More backbone would be put in the shaky regimes of Turkey and Pakistan. Egypt would be in better position to move ahead on peace with Israel. Saudi Arabia and other Gulf states would feel reassured, and more prone to cooperate with the United States and its allies on all matters -- including the flow of oil.

Favorable changes of such magnitude, to be sure, do not get accomplished without risk. The obvious first risk centers on the hostages now held by the Iranians. The passage of time has made it very doubtful that the hostages will be harmed. Still, a threat to the regime would put their fate in hazard. So their lives have to be weighed against the potential for saving many more lives.

A second risk is that Iran, minus the ayatollah, would fall apart, allowing scope for direct Soviet entry on the scene. But that risk exists anyhow, and grows the longer the ayatollah continues to rule. While not certain, it seems likely that competent authorities with popular appeal can be found outside the circle of religious fundamentalists. A military structure remains, as does a large middle class clearly unhappy with the recent flow of events. Many prestigious clerics are at odds with Ayatollah Khomeini.

A final risk is the exposure of the United States as a meddling country with self-interested aims. But it is not as through the United States has to go it alone, and out in the open.

Anwar Sadat has been practically advertising willingness to lead the way. France has important Iraqi connections, a long tradition of influence in Iran and a have-gun-will-travel approach to foreign policy. The Saudis would find occasion to resume their favorite role as paymaster of Arab consensus. Indeed, it is hard to think of any country -- Russia and its clients excepted -- that would not like a piece of the action.

Americans, of course, do not comfortably make such callous calculations of national interest. But that is all the more reason not to let the logic of national interest be lost in a sea of smarmy humanitarianism.