U.S. Defense Secretary Caspar W. Weinberger said today that the mission of the 800 U.S. Marines here "is pretty well completed," and that they would leave Lebanon in "a few days."

Later, President Reagan said in his nationally televised speech that the Marines would leave Lebanon within two weeks.

Weinberger, ending a whirlwind five-hour visit to the Lebanese capital before departing for Israel, spoke at a press conference less than three hours after the last Palestinian fighters sailed from Beirut for a Syrian port.

The unexpected announcement of the Marines' imminent departure came as something of a bombshell to West Beirut's Moslem leaders as well as to European diplomats whose nations are also contributing to the U.S.-negotiated multinational force set up to supervise a peaceful end to Israel's siege of the Lebanese capital.

The Marines, part of a 2,130-man multinational force including French and Italian troops, landed a week ago to stay up to a month to secure the departure of Palestinian and Syrian troops and to reestablish Lebanese sovereignty in war-battered West Beirut.

The Lebanese government announced that 14,420 fighters had withdrawn during the 12-day evacuation, which ended three days ahead of schedule when 633 guerrillas of the Palestine Liberation Organization sailed for Syria on the Greek ship Mediterranean Sun. The government said 12,220 guerrillas and members of the Syrian-controlled Palestine Liberation Army had gone to eight Arab countries and 2,200 Syrian troops had pulled back to eastern Lebanon.

Today's final exodus from Beirut marked the end of the PLO's state within a state in Lebanon, which began 12 years ago when Jordan evicted the guerrillas.

President Reagan sent a message to the Marines commending them on their "selfless devotion to duty" and added, "We are on the eve of achieving what we set forth to accomplish: an end to the bloodshed in Beirut and the reestablishment of Lebanese government sovereignty over their capital."

American officials have been fearful that the Marines could suffer casualties in the volatile atmosphere of Beirut. One Marine was grazed by a bullet when guerrillas fired their weapons into the air in their traditional symbol of victory. Two French soldiers and one Italian have also suffered injuries.

Weinberger said it was up to the French and Italian governments to determine when to pull out their troops but added, "I don't know of any particular duty that would require anybody to stay more than a few days."

There was no sign, however, that the French and Italian troops were preparing to leave but instead were planning to help in the restoration of normality in the no man's land dividing East and West Beirut.

In fact, the Lebanese government announced a program to turn over to the multinational forces and the Lebanese Army the overseeing of operations along the devastated Green Line separating the Christian and Moslem parts of the city.

The government ordered the removal of all barricades in the city, banned armed men from the streets and forbade the numerous militiamen from wearing uniforms or carrying arms.

The plan, announced on government radio and to take effect tomorrow, calls for the abolition of the Green Line and for all intersections between the two sides of the city to be open to unrestricted traffic. Only two crossing points are open at present, and it can take more than an hour to drive across.

One of the major leftist Moslem militia units, the Mourabitoun, ordered its 1,500 fighters to comply, saying, "All security functions for Mourabitoun forces have henceforth ended."

Veterans of Lebanon's seven years of bloody civil war noted, however, that such orders have been issued by the government before but have soon broken down in the heat of the factional strife that plagues this country of 3.5 million people.

It was notable that the Mourabitoun ordered its men to relinquish their positions to the police and gendarmerie rather than the Christian-dominated army, which the guerrillas feel is "anti-Moslem."

French and Italian troops have been carrying the brunt of the international force's work in the still divided capital--the defusing of thousands of mines and boobytraps along the Green Line and the persuading of the belligerent militias to back off their positions. The two countries' diplomats express understanding for that. "The United States always insisted that their men keep a low profile here because they consider themselves more vulnerable to attack," one West European diplomat noted today. "That is something we understood and accepted."

But though the U.S. Marines had never been committed to the more ticklish and dangerous tasks of the multinational force, their presence has been considered crucial to the success of the plan negotiated by U.S. special envoy Philip C. Habib. "The U.S. presence was to be sort of a cushion against the Israelis," said a French diplomat who did not want his name used. "They were a guarantee of Israeli good behavior in honoring their side of the agreement."

"We always thought that the multinational force would give us moral, rather than military, protection," said former prime minister Saeb Salam, a key leader of West Beirut's dominant Sunni Moslem community and Habib's intermediary with Yasser Arafat during the painstaking negotiations that finally led to an agreement. "If the Americans leave now, that will mean that we have less protection for the full implementation of the accord."

Salam said tonight that during the negotiations with Habib, it was Beirut's Moslems, as much as the PLO, who insisted that the multinational force be created. "It was not only to guarantee that the PLO could evacuate its forces peaceably," Salam told an interviewer. "We, the Moslems of Beirut, wanted it to protect us from the Israelis, too."

Salam said that it was his understanding, and that of other Lebanese Moslem leaders, that the multinational force would remain in Beirut for a brief period after the PLO evacuation -- hopefully while Israel withdrew from the capital, including from the international airport.

The Israeli government has neither withdrawn its troops from around the city nor pulled out of the airport as had been expected this week. Israel has made the reopening of the airport contingent on the Lebanese Army collecting heavy weapons that the PLO turned over to local leftist militias, continued use of one of the airport's two runways for Israeli military aircraft and Israeli monitoring of passenger traffic.

[Syrian radio admitted Wednesday that one of its jet fighters was shot down in Lebanese airspace Tuesday, United Press International reported. Israel had said that its forces downed a Syrian Mig25.]

[A Syrian military spokesman was quoted as saying that "the plane was hit by an enemy ground-to-air rocket."]