IN THE PAST 20 years fundamentalism has spread across much of the Islamic world, feeding the social ferment in Arab and non-Arab locales alike, roiling relations with other countries and leading many people in the West to wonder if a fateful clash of civilizations was imminent. As the millennium approaches, the fever is far from burned out; continuing cultural and social alienation make that prospect unlikely any time soon. In a number of countries, nonetheless, the rage has been more or less contained or subdued, and nowhere more conspicuously than in Algeria. Its prime minister, Abdelaziz Bouteflika, was at the United Nations last week energetically advertising a new day in a country that until quite recently had been widely declared to be a sinking and failed state.

In Algeria, a radical Islamic party was on its way to electoral triumph in 1992 when the army intervened, setting off a cruel civil war in which 100,000 people were killed. The army won: Many of the rebels are now taking up an official offer of cease-fire and amnesty and rethinking the terms on which nonviolent fundamentalists could enter the Algerian political arena. Mr. Bouteflika became the leading political beneficiary of his country's transformation under what is essentially a military regime. His election as president last April was at best procedurally dubious, but he regained a measure of balance earlier this month with victory in a public referendum he staged to capture the large and fatigued Algerian peace constituency. Now he says he wishes to steal back the social issues from the fundamentalists, who had shown more concern for the popular welfare than a succession of Algerian governments; an ending to terrorism is an essential ingredient here. Mr. Bouteflika's purpose is to harness the nation's war weariness to his political program of reconciliation and development.

The struggle is not over in Algeria: the horrible killings by a lingering extremist minority continue, though at a much reduced tempo, democracy is still a manipulable thing and the condition of the economy is grim. But the country's progress must be measured first against the trauma it is striving to escape. The same can be said of some of the other countries touched in the past decade or two by extremist fundamentalist currents. Iran is caught in a tense ideological and political struggle between so-called moderates and extremists. Jordan and Lebanon have sought to give a certain political space to law-respecting Islamists. Egypt, facing a hard internal terrorist menace, has fought back with force and a renewed social commitment. Libya's leader insists his country is out of the terrorism business and eligible for Western association. Indonesia, as the daily headlines tell, is on the edge. The trend is not full grown, but notably fewer countries remain, as does, for instance, Afghanistan, in the zone of rage.

Each national effort to come to terms with Islam is distinct. Nonetheless, any single success, or relative success, in standing up to forceful intimidation, in widening the circle of dialogue within the society and in inclining fundamentalists to forsake armed struggle and to turn to democratic ways, affects the overall climate. There lies the potential of Algeria as an imperfect but helpful model of how a country once convulsed by Islam now tries to live with it.