President Reagan yesterday praised the "tremendously successful, almost miraculous" mission of his Middle East envoy, Philip C. Habib, as the U.S. government assumed a public posture of increasing confidence that a large-scale Israeli-Syrian military conflict can be avoided.

The president praised Habib when the veteran U.S. diplomat called at the White House to report on his three weeks of Mideast shuttling, which he is to resume sometime next week.

Habib, speaking to reporters after the 50-minute meeting with Reagan, said "we have managed to achieve some preliminary objectives" by staving off welfare between Israel and Syria in recent weeks, and that the "capacity remains" to move ahead to a peaceful resolution of the immediate issue between the two countries.

Habib stopped short of predicting how, when or even if the issue of Syrian antiaircraft missiles in Lebanon will be resolved peacefully, but he said "there are elements at work in the area" toward this goal, which is "achievable."

It is clear from the guarded remarks of Habib, Secretary of State Alexander M. Haig Jr. and other senior U.S. officials that behind-the-scenes diplomacy within the Arab world, encouraged and assisted by Saudi Arabia, is the principal cause of their hope.

According to diplomatic sources, Syria has signaled its willingness to remove the missiles in a context which does not suggest that the Damascus regime is bowing to Israeli or American pressure.

This larger context, which has been the subject of Habib's discussions in the area and is being pursued in a round of conferences among Mideast states and factions, involves the substitution of Lebanese government forces for hostile and contending parties within Lebanon, thus making it possible for Syria to pull back without losing face.

Saudi Arabia, which was praised yesterday by Habib for "being helpful and constructive" and by Haig for supplying "great assistance" to the U.S. peace mission, is reported to be the main channel of Washington's communication with Syria at the present time.

Habib, who visited Syrian President Hafez Assad twice during his shuttles, indicated at the White House that he would be welcome to return to Damascus as well as other Mideast capitals at any time. Indirect communications through the Saudis, however, avoids the limelight that attends a visit from the U.S. emissary and thus in some respects is easier for Assad.

At the White House yesterday Habib went out of his way to say that the Syrians as well as the Saudis, Israelis and Lebanese "ultimately favor a peaceful solution of the problem."

Haig, speaking in a radio question-and-answer program in St. Louis, repeated his assessment of several weeks' duration that a solution in Lebanon is "a long shot." This time he added, as he did not usually say in the past, "but with each passing day we're accomplishing greater chances for the maintenance of peace."

Like Reagan, who said the Middle East was on "the very verge of war" when Habib began his mission, Haig placed emphasis on the absence of all-out fighting so far.

The secretary of state characterized the situation as "reasonable peace," evidently mindful of the upsurge of Israeli military action against Palestinian and Libyan targets in southern Lebanon during the past several days.

In his remarks at the White House Habib called for restraint by all parties in military actions "which are always unsettling" and with regard to the disposition of military forces. At the State Department, spokesmen David Passage, asked about the new Israeli military attacks, said, "Any resort to violence in the current situation is counterproductive."

Passage also acknowledged officially that the United States believes about 150 Libyan personnel are in Lebanon working with Palestian groups there. Libyan involvement is "strongly deplored" but is in keeping with "repeated attempts" by Libya to undermine peaceful solutions to any aspect of Middle East problems, Passage charged.

In contrast to the praise for Saudi Arabia, the Reagan administration criticized the Soviet Union's role. "I wouldn't say that they've been particularly helpful," said Habib of the Soviets.

The State Department, meanwhile, characterized as "mischievous" a report by Tass, the Soviet news agency, saying that Habib's mission not only "failed to ease tension" but "left the Middle East on the brink of war."