President Reagan told Secretary of State George P. Shultz yesterday to return to the Middle East in an attempt to break what Shultz earlier in the day called the "logjam" in efforts to achieve a withdrawal of foreign troops from Lebanon.

The announcement that Shultz would renew his Middle East diplomacy came after the secretary of state, who is in South Asia near the end of a round-the-world trip, spoke with Reagan by telephone yesterday and told him that there were indications Syria was willing to discuss a pullout, according to an administration official.

The official disclosed that Pakistan, where Shultz arrived yesterday, has acted as an intermediary between Syria, a fellow Moslem state, and the United States.

Shultz spent 2 1/2 weeks in the Middle East in late April and early May, in a mission of shuttle diplomacy that led to an agreement between Israel and Lebanon on the withdrawal of Israeli forces, who invaded Lebanon a year ago. But the agreement was contingent on simultaneous withdrawal of Syrian and Palestinian forces, and Syria, as recently as yesterday, has repeatedly condemned it.

The decision to send Shultz back came amid growing tensions in Lebanon, as rival factions of the Palestine Liberation Organization engaged in heavy fighting in the Bekaa Valley and concern mounted within the Lebanese government that Israel was planning a partial pullback that would leave a power vacuum in the mountains south of Beirut, Washington Post correspondent Herbert H. Denton reported from the Lebanese capital.

The formal announcement by the California White House in Santa Barbara, Calif., where Reagan is vacationing, said that Reagan, after hearing from Shultz "where matters stand in the Middle East," had "directed that the secretary make an effort to stop in the Middle East before returning to the United States."

An administration official said that the only reason the White House did not definitively say Shultz would go to the Middle East was that details of the schedule and agenda of talks with Syria had not been worked out, Washington Post correspondent Juan Williams reported from Santa Barbara.

The official said Reagan planned to speak by telephone with unspecified Middle East leaders today to discuss the Shultz visit.

Anson Franklin, a deputy White House press secretary, said Shultz would discuss "a wide range of issues" in any Middle East talks that he would have, but he would not say whether Shultz would stop in more than one country or how long the secretary might be in the Middle East.

An administration official said that among the unresolved details of a possible stop in Syria was "how the meeting will be characterized," because Damascus did not want to be seen as capitulating to Washington.

Sources in Washington said that while Syria probably would welcome a visit by Shultz as an indication of its importance, Shultz has been reluctant to go there unless he can expect to achieve something substantive. The United States, these sources said, would likely require some "evidence of seriousness" on the part of Syria before Shultz would come.

Shultz, who has already visited the Philippines, Thailand and India on his current trip, is scheduled to fly to Peshawar, Pakistan, on the Afghan border, today and was to leave Pakistan Monday for London. Sources said a Middle East visit probably would take place by midweek.

Schultz told reporters en route to Peshawar that he would be going to the Middle East this week to assess the Lebanese situation, Reuter reported. He added that he was awaiting responses from countries in the region before saying which capitals he would visit. He did not say whether he hoped to go to Damascus.

["We will go to various places in an effort to get information directly and asses the situation and of course push as much as we can for achievements of our basic objectives," the secretary said.]

Earlier in the day, before the White House announcement, Schultz had already indicated to reporters that he was considering a trip to the Middle East, when he said, "We're seeking to break the logjam" in Lebanon.

Until today, there had been no indication that Pakistan was acting as an intermediary between the United States and Syria on the troop withdrawal issue. U.S. officials had said publicly that the purpose of Shultz's visit to Pakistan was to discuss Afghanistan but an administration official said today that it was "tied to a possible stop in Syria."

Although Shultz said after his earlier shuttle mission that Syria had not shut the door on further discussions about a pullout, the militant government of President Hafez Assad has kept up a running attack on the Lebanese-Israeli agreement. Yesterday Syria's state-run radio condemned it again and called on Lebanon to "renounce the pact of submission and wage a nationwide resistance against the Israeli Army," The Associated Press reported.

With virtually no further progress toward a withdrawal since the signing of the Lebanese-Israeli agreement May 17, the White House on Friday issued a strong statement saying that the "policy of the United States has been and remains that there should be as soon as possible a total and concurrent withdrawal of all foreign forces from Lebanon."

Administration sources pointed to that statement again yesterday and said that it had been directed both at Syria and at Israeli Prime Minister Menachem Begin.

The Israeli Cabinet, in its weekly meeting today, is expected to discuss a U.S. proposal last week that it publicly set a date for a unilateral withdrawal from Lebanon as a means of putting pressure on Syria.

A number of Israelis have unofficially rejected that proposal, saying it would remove any leverage it has over Syria.

An administration official indicated yesterday, however, that Syria may be concerned that its refusal to negotiate could harm its image. Shultz, according to the official, told Reagan that the Syrians were willing to talk about a pullout because pressure is growing on them from other Arab countries to withdraw or "be pictured as a tool of the Soviets."

Special envoy Philip C. Habib, the chief U.S. presence in the Middle East in recent weeks, continued his diplomatic travels there, flying from Jerusalem to Beirut, where he met with Lebanese President Amin Gemayel and his aides. Habib was joined in Beirut by two other U.S. special envoys, Morris Draper and Richard Fairbanks. There was no indication of the subject of the talks.

They met as heavy fighting broke out in the Bekaa Valley between Palestinian rebels and loyalists of PLO Chairman Yasser Arafat. Varying accounts put the number of dead at three or six, with several more reported wounded, before a precarious new cease-fire took effect.

Denton reported from Beirut:

The fighting broke out as a delegation of PLO mediators that was formed at an emergency executive committee meeting in Tunis flew to Syria in an attempt to end the factional fighting.

Reports from Tunis indicated that the mediators' flight had been delayed by technical difficulties, although there was speculation here that they had encountered problems in getting permission to land in Damascus.

Analysts here were doubtful today that Syria had any interest in resolving the conflict. Despite the PLO executive committee's call Friday for an end to the warfare, Syrian government-controlled newspapers and radio renewed their attacks against Arafat yesterday.

An editorial in Syria's government newspaper Tichrin said Syria was not concerned with "petty conflict" with Arafat. "In the face of the big Arab and Palestinian causes, all persons are dwarfs," it said.