The Algerian government has been shaken by riots led by Moslem fundamentalists in three cities of eastern Algeria, according to several reliable sources in the capital.

The unrest indicated that the wave of religious fundamentalism that has been sweeping the Moslem world since the success of the Islamic revolution in Iran has started lapping at Algeria, until now one of the most resolutely secular of the Arab leftist regimes.

Without referring to the rioting, which has not been reported here, Algerian President Chadli Benjedid this week made an unusually sharp speech warning "those who fish in troubled water" that "it would be a serious error to mistake tolerance for weakness" on the part of the government.

The Tunisian government also has cracked down in recent weeks against a strong fundamentalist movement that openly expresses its admiration for the Iranian Islamic revolution and its distaste for the Western-style regime of President Habib Bourguiba.

The shared problems of the two neighboring countries, one linked to the Soviet Union and the other to the West, seems to suggest that Moslem fundamentalism may be a problem for any secular government in the Islamic world regardless of whether it is leftist or rightist.

The reports from eastern Algeria all agree that the riots took place in the middle of last week in the towns of Biskra, Batna and El Oued. The Participants reportedly sacked hotels, cafes and restaurants where alcohol is served -- a violation of Islamic religious precepts.

The rioters, said to be inspired by the conservative Moslem brotherhood, also reportedly attacked the brothels provided for the Algerian army garrisons in the region bordering on Tunisia.

One version of the reports from eastern Algeria was that several prostitutes were stoned to death by the demonstrators. This point could not be confirmed but the reports from vaired sources agreed in all other respects.

Coordinated organizational effort was indicated by the fact that the demonostrations took place in at least three separate towns. It was apparently the worst outbreak of public disorder in Algeria since 1975, when spectators at a Morocco-Algeria soccer match responded to some rough police treatment by going on a rampage in which a number of policemen were killed by the angry crowd.

President Chadli spoke this week of the work of "foreign hands." A well-informed Algerian said this referred to neighboring Libya, whose leader, Col. Muammar Qaddafi, combines his Arab socialism with far more Islamic fervor than the Algerian leadership has traditionally displayed. But others saw this as also being a reference to Marxist elements in the troubled Arabic-language sections of the University of Algiers.

Chadli's speech to a meeting of administrators from Algeria's 31 district was made on Monday but only published Wednesday.

The speech was ostensibly aimed against a unversity strike movement protesting the lack of opportunities for Arabic-language students in predominantly French-oriented Algeria. But the president's words were also clearly directed against religious elements, even though religious demands had not been loudly voiced by the Arabic-language students.

"We know who the Moslem brothers are," said an Algerian official. "They talk after the prayers in certain mosques, and those mosques are watched carefully. They have been trying to create a link between their demands and the Arabic-language demands of the students."

After tolerating the Arabic-language strike for more than two months in a striking display of liberalism by the year-old Chadli government, the authorities suddenly hardened their stand this week. The students' Arabic posters and banners disappeared overnight from university buildings.

There is also apparently an official fear of contagion from the Iran revolution. "Khomeini gets on television here very, very little, I've noticed," said longtime observer of the Algerian scene.

The government is responding in part by putting new emphasis on its attachment to Islam. "It is not for certain tendentious elements," said Chadli, "to give us lessons in Islam or in nationalism."

Reversing the usual stress on socialism, Chadli spoke of "the affirmation of our faith in our Arabness, in our Islamic religion and in our socialism." Lest the point be missed, he spoke at another point of "our Arab-Islamic values and our socialist choice."

"There is an unholy alliance of the estreme left and the extreme right," said one Algerian official."They are combining to embarrass the government. Marxists who don't believe in religion are using Islam, and Moslem fundamentalists who are economic conservatives are accusing the government of betraying socialism."

The strike of the Arabic-lanugage sections of Algiers University had been tolerated partly because of open sympathy for the students' cause in many official circles.

The Arabic students represent about a quarter of the university student body of 70,000 students. They tend to be of lower socio-economic origins than the French-language students.

Arabic speakers have been openly discriminated against in the upper reaches of Algerian Society. There are many stories circulated of professors and high officials who throw away or rip up reports or student papers submitted in Arabic.

Those who cannot work in French are seriously disadvantaged in seeking better-paid and higher-ranking positions.

In response to protests against this kind of cultural snobbism, Chadli ordered the arabization of the courts. Six hundred young Arabic-trained law graduates were made judges, and lawyers who can work only in French find they must now hire Arabic-speaking colleagues to plead for them in court.

The arabization issue also touches on whether Algeria chooses to remain a primarily Mediterranean and Western-oriented country culturally and technologically or decides to move closer to the Middle Eastern orbit.

More than a century of French rule left behind a Western social layer that provides the country's link to Western economies. In the boardrooms of Sonatrach, the Algerian national oil and gas company, one must sometimes pinch oneself to realize that one is talking to young Algerian managers rather than French ones. The company's dealings with the outside world are in French and English, and its to people say that they intend to encourage the learning of Arabic in Sonatrach but that they will not accept people who are incapable of working in French or refuse to do so for ideological reasons.