The slaying of a former Egyptian Cabinet minister and the discovery that it was the work of Moslem fanatics apparently bent on a campaign of terror in the name of Islam have shocked Egypt and cast a spotlight on some of the country's political and religious divisions.

Unlike the food price riots of January, this incident has not directly challenged the authority of President Anwar Sadat's government. The slaying itself, after the victim was kidnaped and held hostage, has been condemned as cowardly, senseless and repugnant to Moslem teaching. At the same time, there has been widespread criticm of the security forces for their handling of the case, of the Egyptian religious establishment and of Sadat's political policies that have encouraged the resurgence of Moslem extremist groups.

There are even subdued voices asking whether the political liberalism with which Sadat has replaced the police state system of his predecessor, Gamal Abdel Nasser, is worth it if this is the price.

The government, precariously balanced between Sadat's commitment to political liberalism and the need for security in a society where violence and intrigue are never far beneath the surface has acted with mixed firmness and restraint.

Sadat, who was in Gabon for a conference of the Organization of African Unity when the slaying occurred last weekend, did not interrupt his official schedule. He left the investigation to his prime minister and interior minister, Mamdouh Salem, a career police officer. The president did order that the suspects be tried by a military court, a practice that was common under Nasser but one which Sadat has generally not used.

Salem, in a reaffirmation of the government's policy of tolerating dissent but dealing harshly with those who go too far, warned that "those who tamper with security and freedom will be severely punished."

The victim was Sheikh Mohammed Hussein Zahabi, a prominent scholar from the Islamic University of Al Azhar, the citadel of Moslem learning. For 19 months, until last November, he was minister of religious endowments. That is an adminstrative job, not a doctrinal one, but it is usually held by a respected figure from Egypt's orthodox Moslem hierarchy. He was kidnaped and later killed with a bullet through the eye by members of a bizarre, fanatical Moslem cult known as the "Atonement and Migration Society."

This is an organizaiton that believes Egypt's government is corrupt, its religious leaders heretical, and its social structure immoral. Its members oppose the emancipation of women and preach that true Moslems should leave Egypt for countries where the Islamic code is the law of the land. They are not alone in this belief.

In the past few years Egypt has seen a resurgence of Islamic orthodoxy and of revulsion against the secularization of society. Occassionally the country's leaders pay lip service to such strong religious feeling as in last year's legislation restricting the sale of alcoholic beverages or in the decision by the rector of AL Azhar University that women must cover their heads when they enter campus buildings.

Political analysts says, however, that Sadat has generally condoned the conservative religious groups, even tolerating the reappearance of the Moslem Brotherhood, a movement that Nasser suppressed for doing just the kind of thing now charged to the Atonement and Migration Society. Sadat has sought to use these groups, political sources say, to counter the leftist influence in the country's universities and other institutions where it flourished under Nasser.

The fundamentalist Moslem sects have a record of using violence. They used the occasion of the January riots to sack and burn the night clubs and cabarets that line the road to the pyramids. But the slaying of Sheikh Zahabi and the threats that a campaign of terror would be launched put the Atonement and Migration group far beyond the limits of what the government, or most of the people, are prepared to tolerate.

The group's leader, Shukri Ahmed Mustafa, an agricultural engineer, was arrested yesterday. This morning Cairo's newspapers ppublished pictures of him that bore an uncanny resemblance to California cult figure Charles Manson. The resemblance has been noted by several commentators.

Security officials said that with the arrest of more than 200 of the sect's members, they had moved into the state of "liquidating" the Atonement and Migration Society.

Mustafa reportedly told police, however, that the group has more than 4,000 members prepared to carry out a terror campaign to achieve their aims. When an explosive device went off in one of Cairo's main downtown squares this morning, police immediately blamed Mustafa's organization.

The fact that Mustafa and his followers were well-known to the police and apparently well-supplied with money and weapons has raised the question of why they were allowed to remian at large. Liberal commentators, however, warn against a return to the days when people were arrested, merely because they were considered potentially dangerous.

Despite the revulsion at the fanatical group's tactics there is some sympathy for its critism of the country's Islamic establishment.

Critics of the al Azhar hierarchy charge the sheikhs there with having developed a kind of Moslem Vatican that has arrogated to itself a monopoly on doctrinal analysis - a position that is inconsistent with a religion that technically has neither clergy nor hierarchy.

Religious and social dissenters cannot form political parties because parties based on sectarian principles are prohibited. They have no hope of forcing the elders of Al Azhar into an open discussion.

"The doctors at the Azhar are like the people in the Middle Ages who tried Galileo," said a Moslem intellecutal. "They never considered his ideas, they just branded him a heretic."

However deep the reservoir of sympathy for some of the views of the Moslem fundamentalists and doctrinal reformers may be Egyptians of all ranks seem united in believing that murder and bombings are not the way to gain popular support.

"There is no doubt that something gravely wrong is creeping into the minds of our youth under the weight of the tensions and concerns of modern life," said the influential daily Al Ahram.