Washington — How does he do it? President Reagan has sustained a clear foreign policy defeat in Lebanon. But he does not seem to have suffered a political setback and may in fact gain politically because of removal of the US marines from Beirut.
Diplomatic experts and others knowledgeable about the Middle East are disturbed by what they see as the administration's inept management of Middle East policy and the weaknesses of the President's handling of foreign policy in general. Yet the public appears to view the situation through a different lens. The President may well ''walk away'' from the Lebanon failure because:
* Most Americans want the marines out of Lebanon and don't blame Mr. Reagan for the Mideast mess.
* Reagan's optimism and self-confidence seem to meet a national psychological need.
* The Democrats have not offered any credible alternatives in the Middle East.
* The President is focusing on his domestic record, which still looms uppermost in the public mind.
Latest polls indicate that the Lebanese morass is not necessarily a political albatross for Reagan. The Gallup Organization finds that, since the marines' disengagement, the vast majority of Americans support the pullout but are divided on whether troops should remain offshore.
''There are potential problems for the President but only potential,'' Andrew Kohut, president of Gallup, told the Monitor. ''If Lebanon is seen as a massive disaster of foreign policy, this could cut into his image as an effective leader. But my guess is that people are not reading it as that. The Democrats are beginning to get a bit of focus on the subject, but it isn't yet clear that they can exploit it.''
A New York Times/CBS poll published this week shows more Americans now disapproving than approving of Reagan's foreign policy (47 percent against 39 percent). But two-thirds of those polled said the pullout decision was not a diplomatic failure, and, among those who said it was, less than half held the President responsible.
Much is being made in Washington of the confusion, contradictions, and misstatements that have swirled around the White House handling of the Lebanese crisis, casting doubts on presidential leadership. Yet political analysts note that the inner fumblings of the administration tend to concern the ''experts'' far more than the general public.
''Start with the fact that the public has a positive image of the President as a big, good-looking guy with a record of successes and taking vigorous action ,'' says Austin Ranney, a political scientist at the American Enterprise Institute.
''In the case of Lebanon, no one had a clear idea of why we were there, and the concern of the mass public - not the elite - was that we were taking casualties. A lot of things, like who's in charge at the White House, concern the elites, but the image that sticks with the mass public are the budget triumph in 1981, Grenada, and other things that make Reagan look like a strong leader.''
Even liberal political observers note that the President seems to fulfill Americans' need for a perception of decisive leadership.
''Reagan strikes a tone of optimism and hope and says what people want to hear,'' says presidential scholar Stephen Wayne of George Washington University. ''Though he is vulnerable on leadership - on whether he himself is making the decisions, for instance - he is not tainted, because he's regarded as a decent man, because people don't want another failed presidency, and because he seems to know what he wants, and that's reassuring after the Carter years. So he escapes what would bring down other presidents.''
It puzzles some political savants that Democratic presidential contender Walter Mondale has chosen to assail Reagan for ''leadership by amnesia'' - referring to the President's forgetfulness of detail and absence from many high-level strategy sessions. According to polls, the President scores highest on ''leadership'' qualities and lowest on concrete policies.
Diplomatic and academic specialists, for their part, voice concern about Reagan's management of foreign policy. One source of that concern is that the President, despite his own unfamiliarity with the Mideast, takes advice from aides who themselves are not knowledgeable and bypasses the State Department.
There has been a succession of special US envoys to the Mideast without prior experience, including national security adviser Robert McFarlane. The present envoy, Donald Rumsfeld, is unversed in the complexities of Mideast politics. And Secretary of State George Shultz, architect of the May 17 agreement between Lebanon and Israel, which Syria wants abrogated, has had to learn on the job.
''Reagan does a better job of managing the policy process,'' says a former White House official. ''He gets the options on the table and this helps arrive at a policy consensus. He then sets the general direction and leaves the details to the troops. But he doesn't have enough grasp of strategy and tactics. Furthermore, he gathers people around him whose general response is to use military action.''
A major reason for the President's ability to escape public criticism, analysts say, is the failure of Democrats to offer any alternatives. At the moment, for instance, a move is under way in Congress to relocate the United States Embassy from Tel Aviv to Jerusalem - an action that would run counter to US policy since 1967. Democrats as well as Republicans are supporting the legislation.
''It's clearly an election-year frivolity,'' one expert says. ''It's a gratuitous way of alienating the maximum number of Arabs.''
''There is simply no other credible voice on the Middle East,'' says another specialist. ''So Reagan gets away with everything.''
Some watchers of the White House believe, however, that the President is more vulnerable politically on foreign policy than current polls suggest. ''You can stay ahead of the sheriff but he catches you, and that happens in political life ,'' says one Republican senator. ''You don't stay out ahead for ever. Since the invasion of Grenada the press has become more serious about making the President accountable. The cumulative effect (of diplomatic setbacks) is worrying people.''
In recent days newspaper reporters and columnists have been detailing the inconsistencies and ambiguities in the President's statements on Lebanon and the many disagreements among senior administration officials. The White House continues to maintain that the US policy goals in Lebanon are unchanged. But there are indications of uncertainty and confusion behind the scenes.
If the Iraq-Iran war escalates and the US is forced to take military action to keep the Gulf open, political observers say, the Middle East issue could still pose a problem for the President come November. But for the moment many Americans view the Lebanon redeployment as a sign of Reagan's capacity for political realism and flexibility.