It was well past midnight and the two Lebanese security troopers walked slowly down a Beirut street when an explosion crashed through the dark.

"Long live Sarkis," one smiled to the other, chuckling at his own sarcasm before continuing the conversation as if nothing out of the ordinary had occurred.

In the special ways of Beirut, it really had not. President Elias Sarkis is trying to build an Army capable of enforcing order on a people grown used to savagery, but there is no sign yet that he is near success. Bombings, shooting and robberies are still nightly fare here and killings are so frequent that they are big news only if someone important is involved.

The question has taken on a new urgency, however, since President Hafez Assad of Syria announced plans to withdraw the approximately 20,000 Syrian soldiers stationed here as an Arab peacekeeping force dispatched to stop the 1975-76 civil war.

SYRIAN INTENTIONS are difficult to decipher. The first announcements from Damascus said the entire Syrian force would be withdrawn swiftly. In the face of panic in Sarkis' government, Syrian officials softened their tone, saying whatever they do will happen gradually. Then the word was that the Syrians would pull out of Beirut but remain at hand if needed from bivouacs in eastern Lebanon's Beqaa Valley.

By now, Syrian Prime Minister Abdul Raouf Qasim is saying again that all the troops will return to Syria, but only several thousand have actually turned over their positions in Christian quarters of Beirut to Lebanese Army units. In the Moslem quarters, Syrians still stand guard.Most Moslem Lebanese and their Palestinian guerrilla neighbors want no part of the Lebanese Army as a police force, because they consider it more Christian than Lebanese.

Such suspicions remain the chief obstacle to the Lebanese government assuming charge of its own affairs. The Army has expanded to about 23,000 men since the war and, on paper at least, Moslems get a better chance at leadership posts. The United States has supplied 18 155mm howitzers. Some armored cars and TOW antitank missiles, along with another eight cannons and light weaponry, are to be shipped in by the end of the month -- providing that the port is calm enough to permit unloading.

But even with all the improvements, the Army cannot be used. Memories are still too vivid of its disintegration into Moslem and Christian militias during the war. As a result, the political leadership is afraid to tell the military leadership to come out of the barracks.

SHELLING in the southern Lebanese border region escalated again recently, reaching a peak of about 600 shells by the United Nation's count on Friday of last week. One of the shells hit some boy scouts on an outing near Tyre, killing four teenagers.

The Lebanese government charged that the Israelis also were using their U.S.-supplied 175mm howitzers again to shell the coastal town of Sidon, 35 miles north of the border for the first time since last August. Guerrillas retaliated by firing Soviet-supplied Katyusha rockets into Israel's Hula Valley, also for the first time since last summer.

The newspapers and cafes of Beirut quickly filled with speculation about Israeli and Palestinian intentions. But a Lebanese Army officer, perhaps with ulterior motives, said the whole thing started because Maj. Saad Haddad and his Israeli-backed rebel Christian gunmen had received a new 130mm cannon from Israel and were trying it out against Sidon from the village of Blat, just inside their six-mile-wide secessionist zone separating Israel from Palestinian positions in southern Lebanon.

Nowhere in the discussions, however, did anyone bring up apparently forgotten plans to deploy the Army in the south to recover Lebanese sovereignty from the Palestine Liberation Organization camped on one side of the "free Lebanon" border and Haddad and his Israeli patrons on the other. Instead, Foreign Minister Fuad Butros ordered the Lebanese U.N. representative to lodge a complaint with the Security Council and called in a U.S. diplomat to urge pressure on Israel.

THE DAY AFTER the complaint was made in New York, a new art exhibition opened on Beirut's formerly fashionable Hamra Street. Men and women in the latest Paris chic milled about admiring impressionistic paintings depicting the horrors of warfare inflicted on southern Lebanon, 90 when a young man of battle age arrived in a wheelchair, pushed by another young man, limping badly.

Lebanon has done little to rid the scars of war. It has learned to live with them. Moslems and Christians mix freely at the weekend horse races and invoke each other's gods to egg on their favorites. But hostesses know it is still gauche to invite a Moslem to dinner in Christian Beirut or vice versa -- lunch, yes, but not dinner in the dark.

Landlords have entire buildings empty or occupied by nonpaying squatters who fled violence in the south. But the owners demand rents equal to as much as $2,500 a month for three-bedroom apartments. Lebanese and foreigners, who daily speculate about the possibility of renewed all-out war if the Syrians leave, pay the price -- shrugging when the water goes off for a day or the telephone lines give out because of spring rain.

DESPITE the danger and uncertainty, life in Beirut continues to appeal to many foreigners.When pressed as to why, they cite the food, the easy-going people, the near-perfect weather and the Mediterranean coast. But for many there is something more, perhaps the very danger and uncertainty. A young American woman who plans to leave because, professionally, Beirut is a dead end says: "But I'm staying until fall. I'm going to give myself one more Beirut summer."

THE NASTY SIDE of Beirut life often passes unknown because the newspapers have instituted a form of self-censorship to protect editors' health. Only the obvious is reported -- such as the recent attempt to assassinate Christian leader Camille Chamoun, or the car-bomb killing of another Christian military chieftain's baby.

For those who may feel discretion is overcautious, there is the example of Salim Louzi. A Lebanese journalist known for abrasiveness and outspoken positions, he was kidnaped on his way to Beirut's Syrian-controlled airport recently. His body was found a week later, preserved from decomposition by unusually cold weather. One hand had been dipped in acid during the torture that preceded his murder.

Louzi's killing was exceptionally brutal even for Beirut. But incidents on one day last week included a grenade tossed into an Army truck by a Moslem militiaman, discovery of the bodies of two apparent murder victims, a parliament member's brother wounded in both legs by gunmen who escaped, three bombs going off in shops or cars and a number of robberies by street gunmen.