Beirut will continue to be a high-risk area for Marines in the peace-keeping force unless the undertrained Lebanese army improves and moves aggressively to control the warring factions there, according to military officers with experience on the ground there.

They said that partial withdrawal of Israeli forces may be a political plus for President Reagan and his Middle East peace plan, but it threatens to be a military minus in the short run as contesting forces in Lebanon struggle to fill the power vacuum.

Although there was no indication from U.S. officials that the mortars that killed two Marines yesterday were aimed at them specifically, these first deaths by hostile fire since the Marines went into Lebanon last year as part of a multinational peace-keeping force could be followed by others as the various factions fire away at each other with varying degrees of accuracy.

If more Marines are killed and wounded in this firing, congressional demands to bring them home are likely to intensify in direct proportion to the casualty figures.

Mortars, used widely by enemy forces during the Vietnam war, also loom as deadly weapons for the irregular forces in Lebanon. They are ideal weapons for small units on the move and a nightmare for those defensive positions such as those the Marines occupy around the Beirut airport.

A typical hit-and-run mortar tactic for units outside such an encampment is to sight in the mortars at night, fire the rounds in the morning when the troops are gathered outside their bunkers to eat or start the day's routine and then pack up the mortar tubes and flee. A mortar round is fired out of a smooth-bore tube and comes with almost no warning sound.

Artillery shells give off warning sounds because they are fired from a rifled barrel.

When a mortar shell explodes on impact, it sprays deadly shrapnel in all directions. Troops duck for cover after the first call of "incoming," but the warning comes too late for those caught in the first explosions.

The dead Marines belonged to the 1,800-man--1,200 on the ground, 600 afloat--24th Marine Amphibious Unit, which has been on duty with the multinational peace-keeping force since May 30.

The 24th MAU is scheduled to be relieved in November.

They were the first Marines lost to hostile fire in Lebanon. The first Marine death, however, was Sept. 30, when Cpl. David L. Reagan, 21, of Chesapeake, Va., was killed when an unexploded American-made Israeli 155mm shell packed with bomblets went off as he tried to remove it from the Beirut airport area. The second Marine death was on April 18 when a bomb went off inside the U.S. Embassy in Beirut.

Defense Secretary Caspar W. Weinberger said yesterday that "the fight we've all worried about is starting to break out, and we want to quell it as quickly as possible."

Asked about any possible change in the Marine deployment in Beirut, such as increasing their number, Weinberger said, "I don't want to speculate on anything, except just what's happening right now." During the two barrages, Marine observers determined that the hostile mortar fire was coming from Shiite Moslem positions outside the airport and directed toward Lebanese posts near the Marine positions. The Marines returned the fire.

Pentagon spokesman said that they believe this to be the first heavy return fire from the Marines since going into Lebanon last year. However, Staff Sgt. Alexander M. Ortega, one of the dead Marines, wrote in a letter his family received last week that his unit had returned fire the previous week.

One military officer with experience in Lebanon said that Lebanese army units need almost another year of training before they will be capable of the effective infantry operations needed to contain the fractious forces in the country.