Beirut — ''Batman'' is becoming a well-known figure among Shiite militiamen who surround the United States Marine position at Beirut airport. The tough, Baretta look-alike has the dangerous duty of checking the barbed-wire fence that separates the marines of Gulf Company from the nearby shanties that offer cover for snipers.
On a recent inspection, Batman saw two gunmen with Soviet-made AK-47 automatic rifles on the other side of the fence. But rather than run for cover, the young marine marched ahead. Now they are often there, waiting for him.
Lately they have been talking across the demarcation line. When the gunmen asked the marine's name, he replied on impulse ''Batman,'' a nickname that stuck even in his own unit. Once the gunmen shouted, ''We're coming to get you tonight ,'' to which Batman responded, ''Come along.''
Now the communications are a bit friendlier. ''Why not come over for coffee'' was one recent invitation. Batman suggested they instead come across for breakfast. The exchange, for obvious reasons, could not take place, but the atmosphere has warmed noticeably at that position. The men have so far avoided a direct confrontation.
This is one of the few recorded exchanges between the marines and the local population, since the 1,600-man US contingent began to isolate itself in the aftermath of the October bombing that killed 241 Americans. A new dispersal and protection program has transferred the US personnel into subterranean villages around the airport.
''Our goal is to have everyone working and living underground,'' explained the Marine spokesman, Maj. Dennis Brooks.
Their scattered positions are evident now mainly by the pipes that protrude from small mounds of red clay earth, marking the containers buried deep below the surface that serve as bunkers. Only a few large tents are in the open above, used in daylight hours for mess and administrative matters. At night, Major Brooks said, ''everyone is under cover'' as a result of the still incompleted project launched at Christmas time.
The much-publicized ''sandbag city'' is no more. The new camps have nicknames such as ''bedrock'' and ''the underground.''
They mark a dramatic change from the early days when there was an almost running dialogue between the marines and Lebanese visitors who came to the edge of the perimeter to talk with the US contingent, sell food and souvenirs, or simply watch, enthralled by this elite unit of the Western superpower.
Capt. Hank Donigan remembers those days. He first came to Lebanon in the autumn of 1982 to supervise the evacuation of Palestinian guerrillas and then again after the massacre of Palestinian refugees. Captain Donigan and 40 percent of Echo Company, which he commands, came back last November on their second tour.
''There's not the same rapport as before, no opportunities to talk to the Lebanese,'' he lamented. ''I miss that.''
But Captain Donigan insisted the marines are doing more than just protecting themselves. ''The whole success and stability of the (Lebanese) government is contingent on the US presence here. It's a worthwhile and noble cause. I was personally anxious to come back here.''
He was not deterred by polls in the US showing increasing public and congressional anxiety about the American mission. ''My reply is that we don't want to leave with our mission undone. As long as our presence serves a purpose, I for one will stand and stay. And I would come back again, with enthusiasm,'' he said.
Yet there is a strong feeling in Beirut that, barring unforeseen situations, the multinational force (MNF) will be on its way out sometime in mid-year. Already the French and Italian contingents have announced significant reductions.
And there is increasing talk that United Nations troops, stationed in southern Lebanon since the 1978 Israeli invasion, may replace the MNF. This option was mentioned in public this month for the first time by officials from all four participating countries: the US, France, Italy, and Britain.
As the Daily Star, Beirut's English-language paper, lamented in an editorial: ''The Reagan administration has all but declared the failure of its policy in Lebanon. Statements about US determination to stay the course and denials of a possible military pullout have a distinctly hollow ring at this point.
''Now, some 16 months after the US decided to take on the Lebanese crisis, Mr. Reagan and his administration are looking for the way out, having achieved little and lost much.''
Brig. Gen. James Joy, the new Marine commander, feels otherwise: ''We are able to assist the government of Lebanon in trying to regain control of the country. Although we're not here to keep the airport open, the fact of life is that our presence has assisted in keeping the airport open 90 percent of the time. That's an important symbol to a nation's capital.'' He also suggested that the marines' full contribution would not be felt ''until we are gone.''
Yet the precarious status of the US presence was underlined by the fact that most of a half-hour interview focused on security. ''I'm very sensitive to the claim we're living in a siege mentality,'' General Joy commented. But he conceded ''we're living in a very high-threat environment.''
A visitor senses that the Marine unit fully anticipates another major assault , although there is little concrete information on how or when. ''One of the most effective weapons at the terrorist's disposal is time,'' Major Brooks explained. ''We are aware he can strike whenever he wants.''
Four weeks ago intelligence reports first suggested specific information about an attack by a suicide pilot. But the marines also have to worry about infiltrators by parachute or hang glider, or through their lines that stretch along the Mediterranean Sea. ''Many people laugh when we mention kamikaze swimmers, but they shouldn't. Think how effective frogmen can be,'' Major Brooks said.
And, he added, ''no position is 100 percent defensible.''
Meanwhile, the marines continue to dig in. Asked when the new security program would be completed, General Joy commented, somewhat tellingly, ''We'll never be finished doing enough.''