With the bullishness of a general going into battle, Egypt's new military leader, Hosni Mubarak, has begun an all-out campaign to quash this country's Moslem extremists from whose ranks his government says came the assassins of President Anwar Sadat.

Mubarak, 53, has wasted no time in wielding the "razor-sharp sword of the law," as he called his promise of swift justice for Islamic fanatics in his inaugural speech last Wednesday. He has ordered police to shoot anyone seeking to disturb the peace and declared the death penalty for anyone caught using an unlicensed gun in disorders.

Without publicity, he has launched a manhunt for suspected Moslem extremists in every city and village of Egypt. Sunday, the Interior Ministry announced that it had uncovered a new Moslem terrorist group and arrested 230 of its members. But there are reports that the total of new detainees nearly equals the 1,536 persons arrested during Sadat's early September crackdown on sectarian extremists and other opposition elements.

In the Army, scores of officers and soldiers with "extremist religious affiliations" have been cashiered, and military sources say security officials are intensely interrogating many others at all levels.

Following the spectacular assassination of Sadat by a still unknown number of alleged Moslem fundamentalists at a military parade Oct. 6, it is hardly surprising that the new government has started off with a mailed fist to crush the extremist opposition. The movement has grown rapidly and has come to pose a threat not only to the political establishment but also to the Western-oriented life style of the upper middle-class Egyptians Mubarak has suddenly been thrown into the role of defending.

Sadat had already begun a crackdown on the Islamic right but he had alienated many middle-class elements because he expanded it to include detention of personal enemies and critics. This gave the impression that he was indulging in a personal vendetta and ending his troubled experiment in democracy.

After years of allowing the Islamic militants free rein to build up their forces and appeal in an unsettled Egyptian society, his measures came as a shock, setting off tremors still rippling through the country.

The legacies Mubarak has inherited from the Sadat era are heavy. Not only must the new president deal with mounting social and economic tensions, sectarian strife and the consolidation of his own power; he has facing him a major challenge from the Islamic militants who have made clear their readiness to take up arms against the state.

Mubarak has already adopted a tough policy that amounts to a declaration of war on these Moslem fanatics.

His interior minister, Ismail Nabawi, publicly has interpreted the 98.46 percent vote for Mubarak in the presidential referendum last Tuesday as a popular mandate to "liquidate" the Moslem extremists.

The chief question within Western embassies and among other analysts here is just how serious a threat these extremists pose, and whether this normally easygoing nation is headed for a Syrian-style armed confrontation between security forces and fundamentalists using urban guerrilla warfare tactics.

No outsiders know the intentions of the hardcore extremists or even their number. Reporters who have visited the mosques the past two Fridays since Sadat's assassination have noted a near total absence of the robed and bearded militant fundamentalists. This seems to indicate that they have gone underground to hide or plot, making it even more difficult to judge their mood.

Estimates of their overall strength vary enormously. Sadat, shortly before his death, said the government had a list of 7,000 belonging to one organization alone, the university-based Islamic Groups. Diplomatic sources and other analysts offer "guesstimates" of the size of the hard core, ranging from 40,000 to 200,000.

This seems a tiny minority in a country of 42 million people, but their appeal, by all accounts and visible signs, is far greater than the numbers suggest, reaching into the small villages of the Nile Delta and deep into the urban middle class.

One serious obstacle to gauging their strength and intentions -- even for Egyptian security -- is the nature of the Islamic resurgence here. The movement is not directed or led by a single hierarchical structure like the old Moslem Brotherhood. Rather, it is fragmeted into hundreds of small groups, each owing allegiance to its own emir, or prince, and apparently capable of acting on its own.

Thus it is possible, as the government alleges, that the group that gunned down Sadat acted on its own even though a leader belonged to the larger Islamic fundamentalist group, Takfir Wa Hijra.

Similarly, the government says there is no evidence the Islamic extremists involved in the uprising in Asyut, 240 miles south of Cairo, just after Sadat's death, were coordinating their action with the assassins.

It is the prevailing thesis among Western embassies here, including the American, that the Islamic extremists do not have widespread support from the bulk of Egyptians.

"We were quite convinced there was a large and growing fundamentalist movement," remarked one American diplomat, "but while militant, it didn't have the support of the body politic and some Egyptians were definitely turned off by it." The U.S. Embassy, as well as most other Western missions here, says it still believes the extremists have no widespread following.

In the midst of the fear and uncertainty gripping many Egyptians after Sadat's murder, Mubarak seems to be serving as a rallying point, particularly for the upper middle class. His strong measures and forceful military attitude have reassured a badly shaken society that Egypt is not about to turn into another Iran, Lebanon or Syria.

To lend an air of continuity, Mubarak has kept Sadat's Cabinet and has pledged to fulfill the same promises of peace and prosperity Sadat repeatedly made to the nation.

This and the smooth and rapid transition from one ruler to another seem to have had a soporific effect. The trauma of Sadat's shocking murder already seems a distant nightmare to many Egyptians.

"That's life," a young Egyptian remarked nonchalantly of Sadat's assassination, as he sat lazily watching a soccer game Friday at Cairo's plush Gezira Club while his wife and three small children strolled beneath the banyan trees. "The accident was terrible. But life goes on."

"This government must be consolidated," said one obviously worried French-speaking lawyer who said he knew immediately it must have been Moslem fanatics who shot Sadat because Egyptian leftists lack the suicidal streak to do it. "You Americans must do everything to support it if you don't want another Iran, even to the point of sending soldiers."

Even many lower-class Egyptians seem to welcome Mubarak as a badly needed strongman in a time of national crisis, seeing in him shades of the country's greatest popular hero, the late Gamal Abdel Nasser.

Mubarak belongs to the upper middle class, which has the most to lose from a triumph of the Islamic zealots or a turning away from the consumer-oriented society Sadat began with his "open-door" policy of encouraging foreign investment and increased Western imports.

A general and former bomber pilot, Mubarak was a member of an elite military corps spoiled by higher salaries and privileges even in the austere times of Nasser's socialism.

There is little ostentatiousness about the villa where the Mubaraks live in the middle-class suburb of Heliopolis, but their lifestyle is very much that of the sports club-going upper middle class.

Susan Mubarak, 39, the new first lady, was born of a Welsh mother and is a graduate of American University in Cairo, which caters largely to upper class Egyptian girls. She is working on a master's degree insociology there.

One of the many differences Egyptians note between Mubarak and Sadat, however, is that their new leader is not involved in the tangle of big business deals that Sadat was reputed to be through his close association with Osman Ahmed Osman, Egypt's wealthiest entrepreneur. Mubarak is regarded as having "clean hands."

If preserving the social and economic status quo from the right-wing fanatics is Mubarak's most pressing task, the long-term one remains establishing some kind of equilibrium between the resurgence of Islam and the forces of Westernization pulling this nation in such different directions.

Egyptians may not approve of the violent methods of the Moslem fanactics, but they are by nature a deeply religious people, extremely sensitive to the fundamentalist call for a return to the sources. One indication of this appeal has been the reappearance of the veil and traditional forms of dress among middle-class city women. Another has been the spread of private mosques, which can be found on sidewalks, in building corridors and in homes.

In September, Sadat announced that the state was taking over the 30,000 to 40,000 private mosques. Mubarak is likely to continue Sadat's effort at trying to bring this "unofficial Islam" under the control of the state.

But the continuing existence of many private mosques and preachers shows how difficult it is for the state to control the whole Islamic resurgence, and makes it clear that Mubarak has a difficult task ahead.