President Reagan, seeking to restore momentum to the stalemated Middle East peace process, yesterday named his deputy national security affairs adviser, Robert C. McFarlane, to replace Philip C. Habib as U.S. chief negotiator in the region.

Reagan announced the change as he said goodbye to Lebanese President Amin Gemayel, who has been calling for a new and urgent U.S. drive to bring about the withdrawal of Israeli, Syrian and Palestine Liberation Organization troops from Lebanon in time to rescue U.S. credibility and stave off a major new outbreak of fighting.

McFarlane, who is to leave the White House for an indefinite period to undertake the full-time assignment, said he will depart for major Mideast capitals by the end of this month to explore the next steps in the Lebanese problem and the broader regional peace process.

The key stop in his travels will be Syria, which has refused to withdraw its forces from Lebanon parallel to an Israeli withdrawal under the U.S.-sponsored Israeli-Lebanese pact. In mid-May, Syrian President Hafez Assad rejected a proposed visit by Habib to discuss the situation, seriously eroding Habib's usefulness as a negotiator with Syria and generating a trip to Damascus early this month by Secretary of State George P. Shultz.

U.S. officials acknowledged yesterday that Assad's attitude was a factor in the decision to replace Habib, a veteran U.S. diplomat who was called out of retirement to be Reagan's special envoy in May 1981 at a time of high tension between Syria and Israel.

Habib was described as worn out by two years of intermittent but often intensive travel and negotiating, and increasingly convinced that he had worn out his welcome in several Mideast capitals.

There is no indication, officials said, that Assad will be other than pleased to receive visits from McFarlane, a blunt-spoken former Marine officer who is likely to be seen as a direct and reliable channel to the White House.

Assad's objections to Habib were reported to be personal, arising from the failure of a Habib-negotiated cease-fire between Syria and Israel in the early days of last summer's Israeli invasion of Lebanon. Assad is believed to hold Habib responsible for the breakdown of the cease-fire, though U.S. officials say it was not his fault.

The selection of McFarlane prompted immediate speculation that the White House, which is increasingly dominant in Central American policy and arms control negotiations, is moving to supplant the State Department in day-to-day direction of still another important area of foreign policy.

White House and State Department aides went to some lengths to deny this is the case.

"George Shultz was a fervent advocate" of McFarlane replacing Habib, said Nicholas A. Veliotes, assistant secretary of state for Near Eastern and South Asian affairs, who said he shared Shultz's view.

Other officials said Shultz was aware that the appointment of McFarlane would touch off new speculation about the position of the State Department in policy-making and diplomacy.

But they said this was outweighed by Shultz's good personal relations with McFarlane, his view that the deputy national security affairs adviser is well versed in administration policy toward the Mideast, and his belief that McFarlane's position at the White House "carries a political message" in the region that will be useful.

A White House statement said McFarlane "will continue to serve" as deputy national security affairs adviser, a post he has held since January 1982.

Nonetheless, a senior White House official said McFarlane will "serve in the same capacity as Habib," requiring his full-time attention for an unlimited and indefinite period. McFarlane's office will be at the State Department, where he will report to Reagan through Shultz just as Habib did, the official said.

There are no immediate plans to replace McFarlane as the senior deputy to national security affairs adviser William P. Clark, according to White House sources, but his eventual replacement has not been ruled out.

McFarlane, 46, is not considered an expert on Middle East affairs, but he worked on Mideast problems at several stages of his career: as an action officer on the staff of the Joint Chiefs of Staff in 1968-71, as military assistant to then-national security affairs adviser Henry A. Kissinger at the White House in 1973-75, and during his service as counselor of the State Department from January 1981 to January 1982.

He was brought to the State Department post by then-secretary of state Alexander M. Haig Jr., and undertook mostly unpublicized missions for Haig to Israel, Pakistan, Saudi Arabia, Oman and Egypt, according to associates at the National Security Council.

Habib will return to the business and academic life of a retired diplomat, Reagan said. Characteristically, the publicity-shy Habib had nothing to say to reporters about his latest retirement from government service.

Habib's senior deputy and alter ego in his Mideast negotiations, career diplomat Morris Draper, is expected to undertake a new assignment rather than join McFarlane.

McFarlane recruited Richard Fairbanks, who also has been serving as a special Mideast envoy, to join in the new round of negotiations. Other officials will be added later.

In announcing McFarlane's appointment and in bidding farewell to Gemayel after their White House meeting, Reagan said "the United States remains firmly committed to the earliest possible resolution of the conflict in Lebanon." Reagan promised U.S. "energy and perseverance" in aiding Lebanon and said that "Lebanon can count on our support."

Gemayel, in response, read a prepared statement that "I continue to be confident that the major problems still confronting us in Lebanon and the Middle East can best be addressed and resolved by full cooperation with our Arab community and our American friends." He said the United States and Lebanon "will intensify their consultations until the expected results are achieved."

Members of Gemayel's delegation described the Lebanese leader as satisfied with the planned U.S. effort to break the diplomatic deadlock. These sources said Reagan, in the private meeting, was emphatic that his administration will persevere despite the coming season of presidential politics, which usually places additional constraints on U.S. administrations, especially in dealing with Israel.

An expanded role and size for the multinational peacekeeping force in Lebanon, which now includes 1,200 U.S. Marines, was discussed in general terms during the White House meeting, but Lebanon did not request a specific increase, officials said.

Lebanese and U.S. officials spoke of "new ideas" in the search for renewed momentum toward full withdrawal of foreign troops from Lebanon, but a White House briefing was vague on this point.

Reporters were told that the next step, as seen by McFarlane, is to try harder with a new team to pursue "an intensified dialogue," involving shifts in emphasis rather than any fundamental change in U.S. concepts or strategy.