Ayatollah Ruhollah Khomeini took a major step toward the creation of an Islamic republic in Iran today by naming a prominent moderate political leader as its prime minister.

He warned that anyone who acts against his provisional new regime, formed in defiance of the government, would violate sacred religious law and will be punished harshly.

Khomeini named as premier Mehdi Bazargan, 73, the senior statesman of Iran's revolutionary politics and once a close ally of Prime Minister Shahpour Bakhtiar.

While the choice of Bazargan leaves open a route for negotiation and compromise, it puts the army and Bakhtiar on notice that Khomeini is still pursuing his oft-stated intention of creating an Islamic republic.

As Khomeini made his announcement today, Iran, for the third straight day, was largely free of political violence.

Khomeini, who just five days ago made a triumphal return from 14 years in exile, said Bazargan will name a Cabinet "as soon as possible."

The 78-year-old Shiite Moslem leader ordered government employes, members of the armed forces and all Iranian citizens to "discipline themselves" and to cooperate with the new government. He also asked Iranians to conduct peaceful marches and demonstrations "everywhere in the cities and in the villages."

For the moment, Khomeini's announcement leaves Iran, in effect, with two ruling forces and magnifies the critical question of what the Iranian Army will do when the Moslem leader's call to the streets is heeded.

Khomeini, with some success, has been trying to wean the military away from its long-standing loyalty to Shah Mohammad Reza Pahlavi, who left the country Jan. 16, placing the government in the care of Bakhtiar.

Bakhtiar, after saying he would arrest members of any provisional government, later said he would simply ignore it. But Bakhtiar said last night that if Khomeini declared a jihad (holy war), he would answer with "a bullet for a bullet."

At a news conference in his makeshift revolutionary headquarters here, Khomeini tonight did not call the people to arms. Instead, he invoked religious fealty in calling for the support of the people, and he threatened Islamic law sanctions against those who oppose the provisional government.

When asked what penalties could be imposed upon the army if it acts against the provisional government, Khomeini replied, "The army will not do such. However, if it does, the first punishment will be from Allah and secondly they will be punished then according to Islamic jurisprudence and criminal law."

Khomeini said that "those who take action against the [provisional] government" will be considered participants in an "uprising" and, under Islamic law will be guilty of blasphemy.

He said that the provisional government, on the basis of Islamic law, would "act harshly" against opponents of the Bazargan administration.

A close aide, Ibrahim Yazdi, later attempted to "clarify" the warning, saying Khomeini meant that severe punishment would be applied to persons who "sabotage activities of this government."

Bazargan, who was introduced by Khomeini to a packed news conference, dismissed suggestions that his Cabinet would be a shadow government -- which Bakhtiar had said was acceptable -- and said he was prepared for a forceful response by the army.

Bazargan said that throughout the civil turmoil Iranians have been "welcoming bullets," and he added that "myself and members of the Cabinet and the provisional government are ready to receive them."

The appointment of Bazargan, however, seemed to heighten the likelihood that negotiations between the Khomeini forces and Bakhtiar's government and the army would continue.

Bazargan was a senior adviser to Mohammed Mossadegh, who was prime minister from 1951 until 1953, when he was ousted in a CIA-guided countercoup after attempting to overthrow the shah and replace the monarchy with a socialist government. Bazargan has long held the trust of both Khomeini and Bakhtiar.

Opposition sources said tonight that Khomeini has not stepped back from his persistent refusal to talk with Bakhtiar until the premier resigns, but they suggested the door was still open to further indirect talks for a transfer of power while the provisional government is taking shape.

Informed diplomatic sources said that if Bakhtiar refuses to resign and adopts a strategy of ignoring and trying to isolate the provisional government, then Bazargan probably will attempt to appoint Cabinet ministers, instruct government employes to obey the new leadership and, possibly, occupy government buildings.

There were reports today that troops were stationed inside some government ministries, possibly to prevent Khomeini's supporters from attempting to move in.

Khomeini's stern warning to those who oppose the provisional government is likely to encourage members of the parliament who have not already resigned to quit, thereby further undermining the Bakhtiar government.

Khomeini's long, wide-ranging opening statement, delivered in Persian and translated by aides into English and French, had an authoritative ring with constant religious overtones.

"Religiously, I am entitled to do this... people should obey. Everyone will obey," Khomeini said at one point. He added, "I have to warn everyone to obey, because this is an Islamic and legislative government."

Khomeini said that "although there is no need" for it, he planned to "refer the issue of the Islamic republic to the people," meaning that he would conduct a national referendum. He added, however, that the people had already approved the Islamic republic through a "referendum" of street demonstrations.

Calling Bazargan a "devoted Moslem, a righteous man and a nationalist... with no tendencies against Islamic law," Khomeini said the appointment originated with the Islamic Revolutionary Council, whose membership has not been disclosed. Khomeini said the Cabinet would also be approved by the council.

The Moslem leader noted that "all the private and government sectors" of Iran have "completely collapsed" and that the economy "is virtually a disaster."

But he said that once the present government steps aside, "We will be able to solve all the problems with the support of all the people."

Seated in an armless chair on the stage of a theater and wearing flowing brown robes and a black turban, the white-bearded ayatollah spoke in an emotionless monotone with his hands folded in his lap.

As he pronounced the new provisional government, tens of thousands of women supporters, dressed in the traditional floor length veils crowded a courtyard outside, some chanting "Death to Bakhtiar."

Khomeini's press conference coincided with the daily audiences he holds for his followers -- men in the morning and women in the afternoon.

Moments before his announcement, Khomeini stood at the window at the former girls school that serves as his revolutionary headquarters, and sprinkled holy water toward the screaming crowd. In the crush of bodies, some followers collapsed and were carried away on stretchers.