Libyan leader Muammar Qaddafi disclosed today what he said was a plan by Libyans now in Mecca on the annual pilgrimage to take over the Great Mosque, Islam's most holy site, and called on them to cancel the plan and cooperate closely with Saudi authorities.

In a speech marking the 15th anniversary of his coming to power, Col. Qaddafi said he had learned of the plot this morning from Saudi Arabia's King Fahd, King Hassan II of Morocco and Syrian authorities, who apparently appealed to him to abort it.

The leader urged them, however, not to carry out their project "so that we Arabs perform the mission of meeting in the sacred house of God with the rest of non-Arab Islamic nations in respect and faithfulness."

Qaddafi's remarks came at the start of a two-hour parade of some of Libya's arms newly acquired from the Soviet Union.

Qaddafi reiterated denunciations of the United States, calling it "the leader of international terrorism." He described Washington as the center of "the new Nazism" and "new fascism" and pledged to aid Nicaragua in its struggle with the United States by working to form "as wide a front a possible" with such other anti-American countries as Iran, Afghanistan and Cuba.

"We have fought along with Nicaragua some miles away from America. Libyan fighters, arms and backing to the Nicaraguan people have reached them because they fight with us, they fight America on its own ground," Qaddafi said. Nicaraguan Interior Minister Tomas Borge, who reportedly came here seeking Libyan assistance, was attending the ceremonies and joined in a loud burst of applause.

Libya in the past has been known to give financial assistance to the Sandinista government in Nicaragua, including a $100 million loan in 1981. In April 1983, two Libyan aircraft en route to Nicaragua were found to be carrying arms after making an emergency landing in Brazil.

Although there have been no reports of direct Libyan troop involvement, the United States has made a number of allegations concerning Libyan military assistance to the Sandinistas. According to recent U.S. government releases, the Sandinistas have received four Italian-made support aircraft believed to have come from Libya, as well as helicopters and "about 20 Libyan pilots and mechanics."

Qaddafi's speech included a call to other Arab leaders "to liberate our nation from the Atlantic to the Persian Gulf," to destroy Israel and "to liberate every inch of Palestine, even if we wage the liberation struggle in a pool of blood and cross over bridges made of bodies."

Qaddafi's appeal to the Libyans among the millions of Moslems traveling to Mecca on this year's hajj, or pilgrimage, came at the start of his hour-long speech before the parade.

The 42-year-old Libyan leader said he had been told that "the revolutionary forces and popular masses" of the People's Congress among the Libyan pilgrims had drawn up a plan "to take to the streets of Mecca and control the holy mosque of Mecca."

He asked them to act "responsibly and in close cooperation with the Saudi authorities" to avoid any incidents. "We make this call for cooperation with the Saudi authorities because we are in a stage whereby we would like to unite the Arab nation to confront the hostile challenge and the impending danger facing the Arab nation," he said.

Disclosure of the Mecca takeover plot, reminiscent of the seizure of the Great Mosque by Islamic extremists in November 1979, came less than two weeks after Saudi authorities found arms aboard two Libyan planes arriving in Jeddah with pilgrims. The Saudis refused to allow them to disembark.

Although the incident, which occurred Aug. 18, was reported early last week by NBC, the Saudis have not commented on it publicly.

Sources here said not only two Libyan planes were turned back, but also two Libyan ships carrying pilgrims. Their captains had refused to allow them to be searched for arms, the sources said.

The two incidents reportedly took place about the same time and caused Maj. Abdel Salem Jalloud, the No. 2 man in the Libyan leadership, to fly to the Saudi kingdom to placate King Fahd. Jalloud apparently persuaded the Saudis not to publicize the incidents, although Saudi diplomats have informed others stationed here and in other Arab capitals about what happened.

The two incidents raise the question of whether the attempt to infiltrate arms was connected to the plan, disclosed by Qaddafi today, of Libyan pilgrims to seize control of the Great Mosque. Also left unclear is whether the Libyan pilgrims were acting on their own initiative or with the involvement of the Libyan government.

The two-week siege of the Great Mosque in 1979 was by fundamentalist Moslem radicals said to be seeking to proclaim their leader a prophet. Saudi officials estimated that 60 soldiers, 75 members of the sect and 26 pilgrim bystanders or hostages were killed when troops drove out the assailants.

Libya's system of "People's Congresses," which calls for Libyans to form their own self-governing assemblies wherever they are in the world, allows for a great deal of local initiative. But the Saudis and other Arabs are unlikely to believe that such a plan could be attempted without the approval of the government here.

Yet an involvement of the government would seem to be out of keeping with Qaddafi's present efforts to improve his relations with Arab moderates, notably King Fahd and King Hassan of Morocco, to the point of planning a union with the Moroccan kingdom.

Reports circulating here today said there was little likelihood that Hassan would come here this weekend, as had been rumored, to join Qaddafi in celebrations marking both the Libyan-Moroccan union and his 15th year in power.

Today, Qaddafi praised Hassan and defended the union between Libya's often chaotic system of "direct democracy" and the conservative kingdom of Morocco.

Qaddafi made only a brief mention of the Polisario liberation movement fighting Morocco in the Western Sahara. He has supported it for years but is now abandoning it in favor of alliance with Hassan.

The colonel told Polisario to redirect its efforts, together with the other North African armies, "to march toward Palestine and Jerusalem."

Qaddafi made no comment on the U.S. decision yesterday to restrict Libyan diplomats at the United Nations to the city limits of New York, the most restrictive measures placed on any diplomats there.

The British Foreign Office announced accreditation of the first Libyan diplomat since the siege of the Libyan embassy in April, The Associated Press reported from London. On Friday, Libya had released two Britons detained since the siege triggered by the shooting of a policewoman from the embassy.

Qaddafi boasted repeatedly about his intention to use his arsenal of Soviet-supplied arms for more than parades, saying it would be put to the service of "changing the map" of the Arab world and "inciting and mobilizing the Arab masses so as to ridicule and remove these artificial borders" among Arab nations.

The well-organized parade beside the port included scores of tanks, Frog and Scud ground-to-ground missiles and SA9 surface-to-air missiles. MiG23s and MiG25s flew overhead and several frigates and a submarine maneuvered within the basin.

Special correspondent James Rupert added from Tunis:

As Morocco and Libya instituted their union, there were new signs of concern among their neighbors, France and the United States.

French Foreign Minister Claude Cheysson, ending a visit to Algeria and Tunisia, said the union had raised discord in the region: "This is not a favorable factor for rapprochement in the Maghreb northwest Africa , and we regret this."

As Cheysson returned to France he made clear that one major goal of his talks has been to measure the reaction to the Moroccan-Libyan union.

Diplomatic sources here said Cheysson had heard a particularly sharp reaction from Algerian officials who interpreted the union as a maneuver aimed at Algeria.

Western observers said American worries over the union were underlined by the visit to the region of President Reagan's troubleshooting special Ambassador Gen.Vernon Walters. He spent the day with Tunisian President Habib Bourguiba then said only that they had discussed bilateral and regional issues. The U.S. Embassy confirmed that he had come to Tunis from Morocco, where he met with Hassan.