The Lebanese national police moved into Moslem West Beirut today to assert central government authority there for the first time since the capital was divided in 1975 during an 18-month civil war.

In an effort to end the long reign of armed anarchy in the city, about 300 national policemen, backed by newly painted gray armored cars, took up positions along West Beirut's shell-pocked streets to impose a new government edict against public displays of weapons and against militia roadblocks on streets or around neighborhoods.

The police deployment came only 24 hours after the last of the Palestine Liberation Organization guerrillas, who had so long dominated the city, were evacuated from Beirut under the provisions of an agreement negotiated by U.S. special Middle East envoy Philip C. Habib that was aimed at ending Israel's destructive siege of the capital.

Habib, who came here shortly after Israel's June 6 invasion of Lebanon, left today for a holiday in the United States. He is expected to return later in the month to resume negotiations for the withdrawal from Lebanon of all foreign troops -- Syrian, PLO and Israeli.

The government's efforts to restore security today and end the city's bitter division between Christian and Moslem sectors did not go off without a hitch.

Prime Minister Shafiq Wazzan, who had negotiated the police presence in the city with Moslem and militia leaders, had planned to mark the day by driving his car through the long-closed Sodeco crossing across the Green Line that separates East and West Beirut.

Moments before his motorcade reached the crossing point, frequently closed by sniper fire and bitter fighting since 1975, gunfire broke out. For more than 45 minutes, there was a rattle of gunfire around the crossing and an occasional crump of rocket-propelled grenades.

The shooting, informed Lebanese sources said later, occurred after policemen arrested three militiamen from the area's Partisans of Revolution, a Nasserist splinter group, because they were carrying arms in public despite the government's new ban. The policemen were set upon by 20 other partisans, who freed their companions after a firefight that left one policeman wounded.

Wazzan was forced to switch his planned ceremony marking the "opening" of the city to the National Museum crossing. That crossing is being held by French Foreign Legionnaires from the 2,130-man international force sent here to guarantee the PLO withdrawal from the city and help the government reestablish its sovereignty over West Beirut.

Unfazed by the flare-up of gunfire at Sodeco, Wazzan said today was an historic one for Lebanon. "As of today there is no East Beirut and West Beirut," he told newsmen as he stood under the gaze of French paratroopers and helmeted French Army soldiers. "Today we are turning a new page."

Though the government had initially wanted to deploy its untested Army to enforce its writ, Moslem suspicions about the Army's predominantly Christian command forced the government to compromise by using the more trusted police instead in West Beirut.

In Christian East Beirut today the Army or police presence was still hardly noted. The Christian militiamen of President-elect Bashir Gemayel were still the dominant force in the streets.

In West Beirut, however, the gendarmes did deploy and began assuming duties as the city's police force.

The Lebanese Army, instead of handling the police duties originally envisaged, has only been allowed to return to its barracks in West Beirut and to take over the defense of government buildings. The Army is to act as a back-up force to the police in a crisis, but it can only be ordered into action in West Beirut by Wazzan, a Moslem.

Lebanese Moslems have resisted the Army's presence because they consider it biased in favor of their bitter Christian antagonists since the civil war--Gemayel's 20,000-man private militia, the Lebanese Forces. Moslem leaders have said they will not disarm their men or disband their own militias until Gemayel orders his militia to do the same.