Gen. Gholam Reza Azhari, Iran's military prime minister, theatened today to crack down harder on demonstrators against the shah and branded the government's archenemy, Paris-based religious leader Ayatollah Ruhollah Khomeini, "a tool of the enemies of this country."

In his first news conference since the military assumed power a month ago, Azhari appeared to be challenging Khomeini just before an expected confrontation with demonstrators carrying out the religious leader's orders for antigovernment protests during a key Shiite Moslem mourning holiday this weekend.

Although government propaganda has called Khomeini a Marxist during the country's year-long crisis, officials had previously avoided direct attacks on the religious leader, revered by millions of Iranians. Criticism of Khomeini in a government-planted newspaper article in January was the spark that set off the turmoil in the country.

With demonstrators and violence continuing -- albeit at a lower pace -- and yet another oil strike depriving the government of its major foreign exchange earnings, Azhari nonetheless denied that Shah Mohammad Reza Pahlavi was in danger.

"Not at all," Iran's top soldier said. "The majority of the people are so fond of his activities, the jobs, the improvements he has made. Everybody is so fond of him."

Oil production slumped from a prestrike level of 5.9 million barrels a day over the weekend to a rate of 3.1 million barriels today. Oil sources expected further cutbacks and that output will not return to normal for at least a week. Each million barrels of lost production costs the Iranian government about $12.5 million.

Violence, which took a sudden upsurge last weekend after weeks of relative quiet, appeared to be abating again today, with only scattered reports of gunfire in Tehran and no deaths. A policeman was reported killed, however, in a gun battle in Bushire on the Persian Gulf.

Exuding confidence, the 61-year-old general denied suggestions he was considering a 48-hour curfew during the Sunday-Monday Ashura holiday marking the anniversary of the death of Hossein, the prophet Mohammed's grandson and founder of the Shiite sect of Islam.

Although his military government has already banned street processions on the anniversary, the general said that if religious leaders "give us assurances they can handle them, we may allow them."

Much of the hour-long news conference in the prime minister's office was devoted to lecturing on the evils of foreign-trained "atheists" and "saboteurs" who used "terror" to mislead otherwise innocent Iranian Moslems.

He said these few trouble makers were "tools of foreigners," but when asked to identify them he said, "I don't know what foreigners."

"The policy of the government is to convince people," he said, but "if we are not able to change their minds, I will use force against these guys."

He sought to defend the shah by insisting that the "silent" majority of Iranians remained loyal to the monarch and estimated that only 200,000 of Tehran's 4.5 million citizens had participated in the months of anti-shah demonstrations.

Defending the shah as a man "who has done a lot of good," the general nonetheless admitted "definitely there were bad things," a rare departuture from total support from a military commander.

Azhari reiterated that the shah had no intention of abdicating in favor of a regency council which would rule until 18-year-old Crown Prince Reza reaches his 21st birthday.

In criticizing Khomeini, whose unbending opposition to the Shah has now inspired many Iranians to voice their own criticism, Azhari said he did not believe the ayatollah was the "main figure" behind the mounting drive to overthrow the government.

"He is the tool of enemies of this country who are issuing many things in his name," the general said.

Government propagandists have insisted that Khomeini is putty in the hands of communist extremists. But the 78-year-old divine traditionally has bent over backward to apportion criticism equally among the United States, the Soviet Union and other world powers.

Azhari reiterated the now standard government line that Khomeini could return to Iran "at any time" and would not be arrested "if he behaves himself."

But the general stressed that the military had the authority to detain anyone likely to cause disturbances, a foregone conclusion were Khomeini to take the unlikely decision to return here with the shah still in power.

The government sent Khomeini into exile 15 years ago after an abortive coup linked to the Ashura holiday during which devout Shiites flagellate themselves with chains. Khomeini resided in the Shiite holy city of Najat in Iraq until the Baghdad government pressured him to leave last September.

The general also restated the government line that three Western reporters beaten up last Saturday by Iranian soldiers outside the Intercontinental Hotel were guilty of "attacking" his men.

That version was at variance with eyewitness accounts and statements by the correspondents, two from Newsweek and one from the London Daily Telegraph.

[American officials of the Boy Scouts announced that the Boy Scout world jamboree, scheduled for Iran next summer, has been canceled because of "unsettled conditions there, Reuter news agency reported from New York.]