Less than four months after his Islamic revolution swept away the Iranian monarchy, Ayatollah, Ruhollah Khomeini's once unassailable power base is being steadily eroded by mounting opposition to his autocratic leadershiop.

In the last blow to Khomeini, the board of directors of the National Iranian Oil Co. submitted its resignation to protest attacks by the Khomeini camp on the company's chairman, Hassan Nazih.

That action, made public today, followed publication of an open letter to Khomeini from the National Democratic Front, a liberal political group, accusing him of smothering freedom in the name of unity under his Islamic republic.

The Front, a coalition of fairly obscure parties, may have been seizing a political opportunity in sounding off against the ayatollah. But by becoming the first group to criticize him personally, the Front showed which way it thinks the political winds are blowing.

In the provinces, some members of regional minorities are in near-revolt against Khomeini's government. Ethnic Arabs in the key oil-producing province of Khuzestan reject the authority of government appointees and have joined Iranian Kurds, Turkomans and Baluchis in demanding regional autonomy.

The ayatollah's entourage also has become the target of terrorist attacks by opponents who have assassinated two senior figures and wounded a thrid. A couple of other attempts on the lives of leading ayatollahs reportedly have been foiled.

The broad masses of Iranians have shown no sign of opposing the increased power of the clergy, a major concern of Westernized technocrats and political liberals. But there are indications that a growing number of workers are becoming dissatisfied with the new system and disappointed with its failure to improve their standard of living.

Perhaps the most serious problems Khomeini faces over the long run are economic. About 3.5 million Iranians are unemployed and the government so far has been stymied in its efforts to restart the economy, despite the renewed influx of oil millions. Khomeini may soon have to pay the price of these unfulfilled expectations among ordinary Iranians who make up the bulk of his following, economic analysts here say.

"The political and economic rot is setting in," a diplomat said. He cited increasing alienation among educated and middle-class Iranians, worker indiscipline in factories and government bodies and the inability of Iran's ragtag armed forces to impose order.

By turning in their resignations Saturday night, the seven members of the oil company's board of directors signaled that the top level of the country's most crucial economic institution was no longer willing to tolerate the clergy's interference in all aspects of Iranian life.

In a terse letter the directors said simply, " the atmosphere is not conducive to performing our duties properly."

A company spokesman called the action "a gesture of support and sympathy for Mr. Nazih in the problems he has had with certain religious leaders." It remained to be seen whether the board members would go through with their resignations, which reportedly have been submitted to the Cabi- net of Prime Minister Mehdi Bazargan for approval.

Since the provisional revolutionary government was installed, a foreign minister, at least two provincial governor general and a number of ministry officials have resigned to protest the clergy's interference in government affairs.

Even some Shiite Moslem leaders, reportedly including the relatively liberal Ayatollah Kazem Shariatmadari, have begun to distance themselves from Khomeini, whose uncompromising opposition to the shah gathered overwhelming support from all segments of Iranian society and sparked the revolution.

The latest problem at the oil company started when Nazih, who also is president of the Iranian Bar Association, criticized the religious leadership in a speech to a lawyers' congress in Tehran last week. The bar association congress became a forum for bitter denunciation of plans by the Khomeini camp to do away with an elected constituent assembly to amend and ratify Iran's long-delayed constitution, which is being drafted by a secret body.

According to statements by government officials, Khomeini's new plan was to have a "nominated" assembly rubber-stamp the draft to present it directly to the public in a yes-or-no referendum. The decision to drop the elected assembly apparently reflected fears that secular delegates would try to dilute Islam-based restrictions on basic freedoms that the draft is reported to contain.

For the lawyers, this apparently was the last straw. Their resolution demanded official publication of the draft constitution as soon as possible and its submission to an elected constituent assembly. The lawyers also called for freedom of political parties and the press and dissolution of "the exclusive judiciary" - a reference to the revolutionary courts that have sentenced more than 250 people to death since February.

Ayatollah Mohammed Beheshti, said to be a leading member of Khomeini's mysterious Revolutionary Council, responded by calling for Nazih to be put on trial for possible treason. Khomeini declared that "now the pens are arragned against us, pens in the place of bayonets." He denounced intellectuals who he said were undermining Islam, adding that he hoped the nation would "emerge from this Westernization."

Nazih in turn railed against Beheshti's "vehement lies and absolute calumny" and said he should be put on trail himself. Nazih said he had asked Khomeini to carefully read the text of his bar association speech.

The National Democratic Front's statement contained the most direct criticism of Khomeini yet. The Front, led by lawyer Hedayat Matin-Daftari, accused Khomeini of personally interfereing in affairs of state, allowing his followers to suppress basic freedoms and branding Iranians who believe in democracy as "counterrevolutionaries."

The actions of the Front and the oil company board did not immediately draw any reaction from the Khomeini camp. Citing extreme fatigue, the ayatollah went into seclusion at his home in the holy city of Qom for the weekend. CAPTION: Picture, AYATOLLAH RUHOLLAH KHOMEINI . . . increasingly criticized