Libyan leader Muammar Qaddafi has responded to the first major challenge to his authority in 15 years with a sweeping crackdown on suspected opponents and by tightening the reins of power in the hands of a few trusted aides and the powerful revolutionary committees.

It is now clear, four months after the event, that the May 8 commando attack on his bunker-like headquarters in the Bab Aziziya military barracks in downtown Tripoli has changed the nature of the regime even if Qaddafi outwardly remains much the same.

"May 8 has radicalized both the system and Qaddafi," said one experienced diplomat here. "Things are again fully under his control but at the expense of the new importance given to the revolutionary committees."

Although Qaddafi has seemingly changed tactics in recent months in his foreign policies, adopting new allies and dropping old ones while entering strange new alliances, such as his recent political union with conservative Morocco, there is no solid evidence yet of any basic change in his ultimate goals or in his use of subversion and terrorism to achieve them.

After nearly 18 months of working to improve his relations with King Fahd of Saudi Arabia, Qaddafi reportedly used that "opening to the right" to try to smuggle arms into the kingdom and organize a takeover of the Grand Mosque in Mecca by Libyan pilgrims.

Qaddafi, 42, remains as enigmatic and unpredictable a figure as he was when he seized power as a 27-year-old junior officer, trying now to cope with the first serious manifestations of opposition at home and continuing isolation abroad.

Despite overtures to the Arab world's most conservative rulers and conciliatory messages to the Reagan administration, however, there is little evidence he has changed his iconoclastic ideas or given up his drive to remake the Arab world and Africa in his own image.

His traditional Sept. 1 speech marking his overthrow of King Idris and the monarchy in 1969 contained his usual tirade against the United States -- "enemy number one" -- and Israel and a ringing appeal to the Arab masses to change the map of the Arab world by doing away with its "artificial borders."

To all appearances, Qaddafi seemed the same old firebrand, confident and full of revolutionary zeal. But the attack on his headquarters here has provoked another turn left for his zigzag revolution.

By all accounts available here, the May 8 raid on Aziziya Barracks by a group of dissidents has had an enormous impact on Qaddafi and Libyan society.

Portrayed in the Libyan press as an isolated incident by a small group of Sudanese-trained "terrorists," the attack was actually part of a much larger operation to bring down the regime, according to sources here.

While Qaddafi accused Sudan and the militant Moslem Brotherhood of being behind the attack, it was later found that almost all the dissidents infiltrated from Tunisia.

Officially, 12 of the raiders were killed on the spot. Seven others were hanged in June in a televised execution that, coming during the holy month of Ramadan, revolted many Libyans.

But sources here say other dissidents, individually and in small groups, clashed with Libyan forces across the country through May and into early June.

Outside estimates of the number of opponents killed range from 80 to 120, while those of the number of Libyans rounded up last summer and still being held range from 2,000 to 20,000.

"We believe they tried to suppress all opposition inside," said one diplomat.

Sources here say no high-ranking officers are thought to have been involved, although several hundred soldiers reportedly were among those detained as suspected dissidents or sympathizers.

In addition, questions circulated all summer about the fate of Brigadier Mustapha Kharroubi, chief of staff of the armed forces and one of the original 12 officers in the 1969 revolution. For several months, he was not seen in public.

But Kharroubi reappeared alongside Qaddafi Friday at a military ceremony and seemed to be on good terms with him as the two chatted amicably.

Kharroubi, however, reportedly has been demoted from chief of staff to inspector general of the armed forces, removing him from any operational command, although there has been no official announcement.

The only other high-ranking officer reportedly disciplined as a result of the May 8 attack and its aftermath is a Col. Ishkal, commander in the eastern Sirt region, said to have been dismissed after he objected to the televised hangings.

To handle the dissidents, the government has opened two special political prisoner camps near Nalut, near the Tunisian border, which are believed to hold about 2,000 people, diplomatic sources said.

"After all the denials they issued, it has been quite a shock to the regime -- not a real threat but a real shock," said one diplomat of the sudden appearance of a large opposition. "The leadership has realized all of a sudden that there is a much larger connivance in the country with the outside opposition. Libyans accepted and tolerated a group of infiltrators operating in the country without denouncing them."

The "shock" appears to have resulted in a shift of power from established institutions such as the Army, police and government to the "revolutionary committees."

The committees seem to have become a powerful central command for the country, wielding the real reins of power behind the facade of a revolutionary "direct democracy."

The "direct democracy" structure is made up of more than 1,000 "basic people's congresses" and their ruling "popular committees" at the local level, and a National People's Congress.

Led by a command of 10 to 12 persons, including Qaddafi and Maj. Abdul Salam Jalloud, the number two official, the revolutionary committees are said to have become a law unto themselves since the May 8 events, in charge of interrogations and arrests as well serving as the "eyes and ears" of the revolution within the increasingly independent-minded local people's congresses.

A Norwegian seaman who died after being dragged off the cargo ship Germa Lionel, mistakenly believed to have been involved in the May 8 raid, reportedly was tortured to death under interrogation by the revolutionary committee in charge of Tripoli's harbor.

At a second level, the committees, headquartered since May 8 in Qaddafi's Bab Aziziya Barracks, are said to be led by 300 to 400 carefully trained cadres, operating at the neighborhood level as well as in all workplaces.

"They are important if you want to understand how Libya functions these days," said one resident. "They are present everywhere."

The only sectors where neither these committees nor the people's congresses are tolerated are the armed forces, the banks and the oil sector.

Residents said young people from the committees, toting AK47 automatic rifles, appeared all over the streets after May 8, checking cars, manning roadblocks and arresting people. The fact that Qaddafi trusted these committees with arms during the crisis suggests he still has a lot of supporters in at least some segments of Libyan society, despite evidence of a growing disenchantment with his revolution.

The committees reportedly have taken on a major role in "orienting" the people's congresses since the last National People's Congress in February, when four issues important to Qaddafi were summarily rejected.

These included compulsory military training for women, closing public elementary schools and transferring basic education to the homes, reducing the number of municipalities to correspond to the territory of the military districts -- apparently a move to restrict their autonomy -- and giving women the same right to divorce as men have.

Libya's Bedouin-based society of little more than 3 million is extremely conservative. For example, 15 years after the revolution, there is only one woman in the National People's Congress.

Qaddafi reportedly was furious, particularly over the rejection of compulsory military training for women, and blamed the setback on "reactionary forces" operating inside the local people's congresses.

He took his case directly to the congresses and on March 12 -- after a big demonstration in Tripoli by high school-aged girls favoring training -- got a special session of the National People's Congress to approve compulsory military training for all.

Qaddafi has now set about changing the makeup of the congresses by creating hundreds of new ones packed with his supporters.

During the Sept. 1 celebrations, the National People's Congress, which formerly had 850 members -- the chairmen from each of the local people's congresses -- suddenly had grown. It reached 1,347, according to the official announcement, but western reporters attending the special session called to approve the political union between Libya and Morocco said there were well over 1,700 seats designated for delegates, suggesting that there may now be twice as many local congresses as there were in February.

"Qaddafi is trying to swamp the old congresses to get a new majority in his favor," said one western analyst. "The problem is the reaction of the people. Will they react?"

Meanwhile, analysts here express doubts about how the recently announced political union between the conservative Moroccan monarchy and the Libyan Jamahiriyah, or "state of the masses," can work.

Even with the announcement of this unconventional alliance and the holding here of an international solidarity conference of 290 organizations, the sense of Qaddafi's increasing isolation -- now from old African and Arab radical allies as well -- was made clear by the presence of only one other chief of state at the Sept. l celebrations: Capt. Thomas Sankara, the new ruler of Burkina, formerly Upper Volta.