Cautious optimism that George Shultz may achieve an agreement on the withdrawal of foreign forces from Lebanon prevails in Egypt following the American secretary of state's two-day visit.
''I think Shultz will succeed. The Israelis will demand a high price for their withdrawal from Lebanon, but it can work,'' said a senior Egyptian official.
Egypt noted with appreciation that Mr. Shultz chose to make Cairo the first stop on his swing through the Middle East. But beyond Egypt's conviction that it is strategically, militarily, and in terms of population the most significant Arab country lies the search for a role in future peace negotiations with Israel.
Egyptian officials do not doubt they will be seated center stage at the negotiating table. They argue that:
* The 1979 Egyptian-Israeli peace treaty that restored all of Sinai to Egyptian control will serve as a model for future agreements between Israel and the Arabs.
* Israel will only negotiate on the basis of the 1978 Camp David accords to which Egypt is a signatory.
* Israel wrested the Gaza Strip from Egyptian control during the 1967 six-day war.
* Many moderate states, including Jordan, rely on Egyptian expertise in dealing with Israel.
President Reagan's call for Palestinian self-rule in the Israeli-occupied territories in association with Jordan implies that King Hussein, rather than Egypt President Hosni Mubarak, will be the main Arab player in negotiations with Israel.
Egypt broke off talks with Israel on autonomy for the Palestinians in the West Bank and Gaza Strip following Israel's invasion of Lebanon last year.
President Mubarak has since called on Jordan and the Palestine Liberation Organization (PLO) to reach an agreement that would allow the Egyptians to reenter the peace process.
Sources close to Mubarak do not rule out that Egypt's ambassador to Israel - back in Cairo since last June - will return to Tel Aviv once the agreement on withdrawal of foreign forces from Lebanon has been reached.
They say that Egypt may then respond positively to an Israeli call for the resumption of the autonomy negotiations.
Mr. Mubarak is believed to be keeping all doors open. He ''supports Camp David, endorsed the Arab peace plan (which calls for an independent Palestinian state), and emphasized the Reagan proposals,'' said one Egyptian official.
Privately, Egyptian officials regret that Reagan's plan rules out the establishment of an independent Palestinian state. They do not foresee a negotiating role for the PLO.
These officials fear that President Reagan's call on moderate Arab leaders to drop their recognition of the PLO if Yasser Arafat does not allow Jordan to negotiate for the Palestinians may ''have complicated the issues.''
Mubarak responded to Reagan's remarks by noting that the 1974 Arab summit in Rabat had recognized the PLO as the ''sole legitimate representative of the Palestinian people.''
Aides to Mubarak emphasized that he spoke of Arab rather than Egyptian recognition. Mubarak's statement, they say, was aimed at preempting Palestinian accusations that Eygpt is trying to undermine the PLO.
''Egypt does not make PLO participation in the peace process a condition,'' said a senior Egyptian official, pointing out that the PLO is not mentioned in the Camp David accords.
Western diplomats involved in the attempts to break the deadlock in the peace process admit that the focus is shifting from Cairo to Amman, Jordan's capital.