Secretary of State George P. Shultz conferred with Egyptian President Hosni Mubarak for four hours today, and Mubarak afterward expressed hope that Shultz's Middle East trip "will conclude with something beneficial to the whole area."

The meeting, which lasted almost three hours longer than scheduled, marked the first step in Shultz's effort to use personal diplomacy to reinvigorate President Reagan's faltering Middle East policies.

But, while his session with Mubarak appeared to be extremely cordial, the stop here is not regarded as central to Shultz's goals of seeking an agreement on withdrawal of Israeli forces from Lebanon and breathing new life into Reagan's stalled Middle East peace initiative.

Mubarak is America's closest ally in the Arab world, and U.S. officials noted that it is important for Shultz to seek his views and keep him closely informed about U.S. moves in the region.

However, because Egypt's peace treaty with Israel has isolated Mubarak from most other Arab leaders, he is greatly limited at present in his ability to influence Middle East events or to give Shultz much help beyond moral support.

Talking with reporters, Mubarak, with Shultz at his side, reiterated his "full support" for U.S. efforts to achieve a Lebanon agreement and for Reagan's hopes of drawing King Hussein of Jordan into expanded peace talks with Israel and Egypt.

U.S. efforts to woo Hussein have been blocked by the king's inability to get an endorsement from the Palestine Liberation Organization to enter the peace process as spokesman for the Palestinians.

Shultz, in his public comments today, said that Reagan and Mubarak are totally in accord on the need for an agreement to withdraw all foreign forces from Lebanon and for resolving the Arab-Israeli conflict through negotiations.

Shultz said he expected PLO guerrillas to "honor the commitment that I understand they have given to the government of Lebanon that they will withdraw."

On Wednesday, Shultz travels to Jerusalem to begin talks with Israeli Prime Minister Menachem Begin on breaking the impasse that has frustrated a Lebanon withdrawal agreement.