Hundreds of Americans and other foreigners flew out of Iran today as violence and political turmoil continued to unravel the rule of Shah Mohammad Reza Pahlavi.

The shah's designated civilian prime minister, Shahpour Bakhtiar, neared completion of a government that might enable the shah to keep his title if not his power. But indications were mounting that the monarch -- as he has throughout the year-long crisis -- may have moved too little, too late to restore order to his troubled country.

Iranian soldiers moved into the control tower of Tehran's Mehrabad Airport to replace striking controllers. About 300 dependents of U.S military personnel fled aboard U.S. Air Force C5 and C141 transport planes and other foreigners left on commercial flights that also began taking off again.

Almost all the 2,600 Westerners who worked in the oil fields that made Iran the world's second-largest oil exporter after Saudi Arabia have left the country. Oil experts said that if striking Iranian oil wokers went back to work, production would return to normal levels but foreigners are still essential for exploration, drilling for new wells and sophisticated recovery techniques.

Canada, Ireland, New Zeland, Belgium and other countries were sending planes to carry out their nationals. An Irish plane carrying 39 British and Irish air hostesses who worked for Iran Air, the country's grounded airline, was forced down by air force jets at Tabriz, in northwestern Iran, and ordered to return to Tehran. It took off again tonight, the reasons for its forced return still unclear.

More violent confrontations between troops and civilians were reported today in Qazvin, northwest of Tehran. Opposition sources said the army went in shooting in retaliation for an assassination attempt on the son of the military governor.

The state television reported tonight that clashes and demonstrations also occurred in Shiraz, Firuzabad, Rezayeh on the Turkish border, and other towns.

Workers at the Central Bank met this morning and agreed to continue their strike until the shah leaves the country. Even the staff of Pars, the official news agency servile to the shah for years, walked out, saying they would "join the nationalist struggle" and stay out "until the sacred national victory is achieved."

There were signs here that the United States, which has been a firm supporter of the shah and as a resualt has earned the hostility of many Iranians, is tilting toward a face-saving compromise proposed by Bakhtiar in which the shah would leave the country on the pretext of a vacation while retaining his titles and nominal command of the army.

Although officials at the shah's imperial palace deny it, informed sources say Bakhtiar agreed to take on the near-impossible task or restoring order only on condition that the shah depart at least temporarily.

It was reported tonight that he will announce on Wednesday formation of a Cabinet containing some personalities not tainted by association with the shah and offer this government plus the shah's departure for "meical treatment" as his solution to the crisis.

That would get the shah out of the country and it is doubtful whether he could return as monarch. But prominent opposition figures, led by National Front leader Karim Sanjabi and the exiled religious leader, Ayatollah Ruhollah Khomeini, reject even the Bakhtiar formula and insist on an end to the monarchy,

The reason for that, according to several sources, is the widespread fear that, if allowed to retain his title and eventually return to Iran, the shah would again succeed as he did in 1953 in rebuilding his power.

Suddenly free to think and act as they please after years of repression, Iranians are enjoying their collective strength and unwilling to jeopardize it in the kind of compromise devised by Bakhtiar.

"The shah had the chance to accept constitutional monarcy back in 1953. But he wouldn't do it. He might try it again," an opposition lawyer said today.

In 1953 the shah, out-maneuvered by the late prime minister Mohammed Mossadegh, fled the country. But he returned in a countercoup engineered by the U.S. Central Intelligence Agency.

One experienced diplomat summed up the situation this way: "Either Bakhtiar will fail to form a governent, in which case the shah will have to go, or he will succeed in forming a government and fail to restore order, in which case the shah will have to go."

In a televised speech Monday night, Bakhtiar pledged to put an end to corruption, phase out martial law, release political prisoners and restore freedom of the press and political parties. Even he, the shah's last ditch choice as prime minister, said the shah's ogvernment has been corrupt for the last 25 years and he disassociated himself from all the policies of the monarchy.

But the opposition, which appears to be gaining supporters each day, is not satisfied. Graffiti attacking Bakhtiar already have appeared on the streets and he is being denounced by demonstrators. That is because he has agreed to form a government while the shah is still at least nominally in power, which the opposition no longer accepts.

"Three months ago, even three weeks ago, the Bakhtiar formula would have been a odd enough," prominent opposition leader said today. "Now it is too late."

That assessment is shared by many Western diplomats and Iranian intellecturals, businessmen and union leaders.

It is too late, they say, because of nationwide resentment of the way the army has put down demonstrations in Tehran, Mashad and several other cities Stories of military atrocities have inflamed an opposition already nurtured by a quarter-century of political repression, secret police torture, and flagrant corruption. Even the shah has acknowledged those errors.

Reports from Mashad, in the northeast, say that residents are bitterly resentful of the army, which they say fired into crowds and ran over demonstrators with tanks during clashes there last week. In an indication of the prevailing mood the demonstrators have taken over the Hyatt Hotel in Mashad, a symbol of the American presence, and renamed it "Khomeini Hospital."