A heavily armed university dropout who seized seven hostages to protest Egypt's peace treaty with Israel was shot and seriously wounded today by a special anti-terror squad that stormed the rural clinic where he had held his prisoners for 19 hours.

The siege at the village of Aghour, 20 miles north of Cairo, was the most spectacular act of domestic opposition to President Anwar Sadat's policies of peace with Israel. It began yesterday at about the same time that Eliahu Ben-Elissar, Israel's first ambassador to Egypt, was presenting his credentials to Sadat in a friendly ceremony at Cairo's Adbine Palace.

Police told an Associated Press reporter who went to Aghour shortly after the shooting that the 23-year-old student was mentally deranged.

Whatever the man's mental state, however, the hostage-taking focused attention on the weak and often ignored Egyptian opposition to Sadat's peace policies at a time when the president was particularly eager to present a country united behind him. As if to underscore the protest, dozens of students demonstrated briefly at Cairo University later today, criticizing relations with Israel and shouting Islamic slogans, sources reported.

Reflecting the government's embarrassment, the Interior Ministry kept the Aghour violence quite long after word had leaked out through unofficial channels. The Egyptian state radio and the official Middle East News Agency still were not reporting it.

The semiofficial Egyptian newspaper Al Ahram similarly ignored news conferences sponsored Monday by opponents of the treaty with Israel and a few peaceful protests yesterday in Cairo coinciding with Ben-Elissar's presentation of credentials.

Opposition to the treaty within Egypt comes from several leftist groups generally identified as Nasserites -- followers of the pan-Arab tenets of the late president Gamal Abdel Nasser -- and from religious fundamentalists such as the Moslem Brotherhood, who claim contact with Israelis will taint Egypt's Islamic tradition.

Egyptian and foreign observers agree, however, that an overwhelming majority of Egypt's 41 million inhabitants support Sadat and his peacemaking with the Jewish state. On the left as well as the right, Sadat's opponents represent only a thin layer of the population, so far unable to stir any broad following, they say.

There was no indication whether the terrorist, indentified as Saad Halawa, belonged to any organized group. But his equipment -- a sawed-off shotgun, a submachine gun, a bullhorn and a spotlight -- seemed to indicate prior preparation and unusual access to arms. Egyptians ordinarily do not carry weapons.

Police officers at Aghour said Halawa demanded that Ben-Elissar be expelled from Egypt and that the normalization of relations with Israel be reversed. He used his spotlight to frustrate police sharpshooters' infrared sights during the night, they added.

This tactic also seemed to suggest careful preparation for the operation, observers noted, as did tape recordings of Islamic and anti-treaty broadcasts from foreign radios that he played during the night.

Five of the seven hostages in the clinic escaped before the antiterror squad attacked shortly after dawn. One of the two remaining was injured and Halawa was "riddled with bullets" in the assault, police told the AP reporter.

Although bombs have been planted at a Cairo post office and at the Sheraton Hotel here since the Camp David accords, these operations were blamed on foreigners acting for foreign governments. Halawa's takeover of the clinic was the only other reported act of opposition here that went beyond speechmaking or demonstrations into violence.

The most dramatic of the peaceful demonstrations yesterday was the burning of an Israeli flag at the Cairo headquarters of a syndicate of left-wing lawyers. The syndicate has opposed Sadat on a proposed new "law of shame" that would set up special courts to try dissenters and those who violate Egypt's Islamic tradition. But the group that burned the Israeli flag was said by lawyers to represent only a handful of the syndicate's membership, not including syndicate leader Mustafa Marei.

At the same time, leaders of the leftist Progressive Unionist Rally presented protests at the People's Assembly, or parliament, against what they called Sadat's "surrender" to Israel. They said their party also distributed 50,000 miniature Palestinian flags for a show of popular defiance. dOnly a few were visible in Cairo.

Rally leader Khaled Mohiddin said the Interior Ministry had forbidden a protest march also planned to coincide with Ben-Elissar's credentials ceremony.As a result, he added, the party called off its plans in a careful effort to remain within the law.

The Progressive Unionist Rally claims a membership of 30,000 throughout Egypt. The active membership in Cairo appears to comprise mostly Westernized journalists, lawyers and intellectuals drawn to leftist ideology of the discursive French socialist style. They include no members of parliament.

The Socialist Labor Party has about 30 members in the 392-seat parliament. It has avoided opposing Sadat's peace moves as such, but its members frequently have made speeches criticizing various aspects of them.

In a similar current, 40 Egyptians, including two current and eight former parliament members, signed a declaration Monday establishing a "national front" against the growing relations between Egypt and Israel. The group includes two members of the Free Officers who under Nasser and along with Sadat toppled the monarchy in 1952. Former prime minister Aziz Sedki and eight former Cabinet ministers also are members.

A similar group issued a declaration for popular opposition soon after Sadat signed the Camp David accords in September 1978, observers recalled, but it drew no broad response.

Security police last month arrested a number of Moslem extremists in Alexandria and Cairo after a shootout at the group's Alexandria hideout that police said was stocked with a large array of weapons, including submachine guns and grenades.

The members of a group called "Al Jihad," the Arabic name for Moslem holy war, were said to include the peace agreement with Israel among their reasons for opposing Sadat's government.