In Iran yesterday, the specter was raised of a military coup against the fragile civilian government of Prime Minister Shahpour Bakhtiar. In France, religious opposition leader Ayatollah Ruhollah Khomeini rejected President Carter's appeal for support of the Bakhtiar government. In Washington, a more optimistic note: State Department officials violced the belief that there are prospects for stabilization of the newly formed government in Tehran as an outgrowth of negotiations between military and religious leaders as well as opposition politicians.

Prime Minister Shahpour Bakhtiar, struggling to keep a grip on power, today raised new fears of a military coup as his faltering government headed toward a showdown with religious opposition leader Ayatollah Ruhollah Khomeini.

The religious opposition has called for massive peaceful demonstrations Friday to demand that Bakhtiar's government, formed under the aegis of Shah Mohammad Reza Pahlavi, be dismantled in favor of an Islamic republic.

Reports from Paris said Khomeini rejected an appeal by President Carter to give the Bakhtiar government a chance at leading the country out of its economic and political chaos. The move appeared to dash hopes of a compromise between the ayatollah and Bakhtiar, to whom Washington has thrown its upport.

In what was seen here as a lastditch attempt to reach such a compromise and save his fragile administration, Bakhtiar today dispatched Jalaleddin Tehrani, 81, a member of the new Regency Council known for his religious credentials, to call on Khomeini in Paris.

The ayatollah announced in advance, however, that he would refuse to see Tehrani except to receive his resignation from the Regency Council.

Apparently sharing the mounting public fears of military reaction if Khomeini goes through with his plans for an Islamic republic, the opposition National Front has sent an envoy to seek its own compromise. Aides of the ayatollah have indicated the front would not be included in the proposed Islamic government.

Adding to pressure on the Bakhtiar government were resignations of parliamentary deputies, continuing trouble in the provinces and a threat by oil workers to cease even the present limited production for domestic use unless the army stops shooting demonstrators.

A senior opposition figure said the Bakhtiar administration is in danger of falling apart, with the prospect of a parallel Khomeini government and the resignation yesterday and today of his justice minister along with 20 parliament members. Friends of Bakhtiar already have started advising him to resign, he added.

Another source of worry for Bakhtiar came from a reported attack on a police post in western Iran. According to an army communique, about 60 armed Kurdish guerrillas crossed the border from neighboring Iraq and besieged the post, injuring two Iranian soldiers and capturing three. There was no immediate explanation for the reported attack.

Amid signs of army restiveness, Bakhtiar told reporters that the show-down between him and Khomeini over Iran's future government was approaching.

He said that on orders of the shah, who flew into exile Tuesday, the royalist armed forces committed themselves to support his new "social democratic" government despite its opposition flavor. However, Bakhtiar warned, that commitment would end if his government fell. He said he though a military coup would result if he were forced to resign.

Bakhtiar said he would never agree to Khomeini's call for the abolition of the Regency Council, formed shortly before the shah's departure to preserve at least a vestige of Pahlavi rule. But the prime minister hinted it might be possible to coexist with an "Islamic revoluntionary council" demanded by Khomeini if such a compromise were offered, even though this would form an emerging "parallel government."

A senior opposition figure with close ties to Khomeini said, however, that the exiled ayatollah seemed determined to press ahead with plans to install his own republican government and was counting on sufficient army support to keep the military leadership from trying to act against him.

Military and political analysts said Khomeini's apparent assumption of army nonresistence might be dangerous. They noted reports of violent provincial incidents in which royalist troops angered by the shah's departure have attacked demonstrators.

Opposition sources cited further such troubles today in the southwestern towns of Ahwaz and Dezful. The sources claimed at least 30 persons died died yesterday in an army shooting in Ahwaz, the administrative center of the Iranian oil industry, prompting a threat by oil workers to annul a recent agreement to produce enough oil for internal needs.

The state-run news agency, Pars, reported six dead and 20 wounded in a similar incident in Dezful, and opposition sources accused the army of revenge attacks on anti-shah citizens in at least three other towns.

The opposition has expressed convern over possible military intervention to prevent Friday's marches through Tehran, but warned that they would go ahead anyway.

"We're relying on the power of the people," said one of the march organizers, Mullah Mohammed Momateh. "We expect more than two million people to turn out. If the army tries to intervene, the people will resist and will continue their march."

Another organizer said the demonstration had three main aims: "to declare that the shah cannot come back, to show that the government of Shahpour Bakhtiar cannot satisfy the demands of the present revolutionary movement and to say that we ought to have an Islamic republic."

Former U.S. attorney general Ramsey Clark, a political liberal who has come to Iran to voice support for the opposition movement, said he would take part in the march.

A senior opposition figure siad Khomieni would probably announce his revolutionary council soon after the march. He said the ayatollah's idea was for the council to name a provisional Islamic government shortly thereafter.

"Nothing can stop Ayatollah Khomeini from going ahead," the official said.