The death and destruction from the Sept. 20 bombing at the U.S. Embassy annex in Beirut may have the unexpected effect of sparking a new effort to arrange the withdrawal of foreign forces from Lebanon.

U.S. officials and diplomatic sources said the terrorist attack has underscored to Israel and Syria that they have a common interest in defusing the fanaticism that keeps Lebanon in chaos and prevents them from achieving their goals there.

As a result, Richard W. Murphy, assistant secretary of state for Mideast affairs, who rushed to Beirut after the bombing, found his trip transformed into a mission to determine whether Israel, Syria and the Syrian-dominated government of Lebanese President Amin Gemayel are willing to use the United States as a go-between to find a formula for Israeli withdrawal from southern Lebanon.

Murphy's presence in Damascus last week to discuss this possibility with Syrian President Hafez Assad seemed ironic. A few months ago, the Syrians allegedly were encouraging terrorist assaults, like the bomb attack that killed 241 American servicemen at the Beirut airport a year ago, as part of a successful campaign to force the United States out of Lebanon, break Gemayel's dependence on U.S. patronage and abrogate the U.S.-mediated 1983 withdrawal agreement between Israel and Lebanon.

So complete was Syria's success that Israel's new defense minister, Yitzhak Rabin, recently acknowledged, "Syria will decide Lebanon's political future." But, to maintain that position, Syria must end the murderous feuding among Lebanon's myriad religious and political factions and unite them behind a Gemayel government responsive to Assad's direction.

However, the Syrians have found that is not easy to do, especially when key factions such as the Shiite Moslems, most populous group in southern Lebanon, express their frustration at continued Israeli occupation through renewed terrorism.

Israel's new national unity government, under strong political and economic pressure domestically to end its two-year Lebanese adventure, has said it is willing to drop its insistence on simultaneous Syrian withdrawal and consider a unilateral pullback.

Also, the sources said, while there still are questions about how far Syria is willing to go to make an Israeli withdrawal possible, Assad has come to realize that his goal of a pacified Lebanon can be achieved more easily if the irritant of Israeli occupation is removed.

Brian E. Urquhart, a U.N. undersecretary general who visited the Middle East just before the embassy annex bombing and who played an important role in paving the way for Murphy's current efforts, said:

"There definitely has been progress toward a common ground. Everybody wants to see the internal Lebanese situation regularized and less susceptible to extremist pressures. The situation is clearly negotiable. It's a question of working it out."

But, while that sense of new opportunity set Murphy on a course that took him to Lebanon, Syria, Israel and Jordan, those involved have been careful to characterize his efforts as an exploratory mission that is a long way from determining whether new negotiations are possible.

Murphy, who returned here Saturday, conferred with Secretary of State George P. Shultz yesterday. U.S. officials cautioned afterward that they believe considerably more exploration, including talks in New York today between Shultz and Israeli Foreign Minister Yitzhak Shamir, continuing here next week when Israeli Prime Minister Shimon Peres visits President Reagan, will be required before the United States decides if it can play a constructive mediating role.

One new factor that could cause trouble was the decision by Jordan last week to resume diplomatic relations with Egypt and the fiercely negative reaction that this provoked from Syria, which fears that the move might be a preliminary step toward Jordan's joining expanded peace talks on the future of the Israeli-occupied West Bank and Gaza Strip.

The fate of the occupied territories technically is an issue separate from Lebanon. But Syria, which warned that it is prepared to apply "deterrent measures" to keep Jordan's King Hussein out of the peace process, could drop its nascent interest in reaching an accommodation over Lebanon if it considers that necessary to block progress on the wider issue of Arab-Israeli peace.

This is because Syria aspires to leadership of the Arab world and opposes any moves that might strengthen the moderate bloc of Arab states.

There are other problems relating directly to Lebanon. Central to Israel's planning for withdrawal has been creation of an Israeli-influenced Lebanese force under Gen. Antoine Lahad that effectively could police southern Lebanon against the return of Palestine Liberation Organization forces and insulate Israel's northern border from terrorist attacks.

However, in his talks with Murphy, Assad is understood to have made clear that Syria will not agree to such an autonomous force operating in southern Lebanon. While the Syrians said they were willing to consider "other mechanisms," such as expanded powers for the U.N. forces in southern Lebanon, it is unlikely that Israel would regard that as an acceptable substitute. The sources stressed that a lot of negotiating will be required if that gap is to be bridged.

"The general objective of Israeli withdrawal is what everyone wants, but it will be a long process even if everybody agrees on everything because the details have to be worked out completely," Urquhart said. To reach that point, some sources said, could take six to nine months.

But, the sources said, even with these obstacles, there is greater flexibility on all sides than has been evident at any time since Reagan withdrew the bulk of the U.S. Marine force from Lebanon last February.

According to the sources, the shift began to be evident during the summer. The Gemayel government signaled at that time that it had a green light from Syria to seek U.S. help in making "security arrangements" for southern Lebanon to replace the formal Lebanese-Israeli agreement abrogated under Syrian pressure.

Such arrangements, it was made clear, would have to drop features of the 1983 agreement objectionable to Syria. Those were Israel's insistence on making its withdrawal contingent on simultaneous pullout of Syrian forces in Lebanon, Israel's right to send soldier inspection teams into southern Lebanon and provisions for negotiations on establishing relations between Israel and Lebanon.

However, the sources continued, the signal also stressed that Syria "understands Israel's need for security against attack from Lebanon" and its concern that the vacuum left by an Israeli withdrawal from southern Lebanon not be "filled by hostile elements."