The Reagan administration, sounding increasingly optimistic about the chances for an agreement on evacuating Palestinian guerrillas from Beirut, said yesterday, "The momentum of the negotiations continues to build."

While declining to discuss details of the talks being conducted by President Reagan's special envoy, Philip C. Habib, administration officials were clearly encouraged by Israel's acceptance in principle of Habib's plan for removing the Palestine Liberation Organization's leaders and guerrilla fighters from Lebanon.

State Department spokesman Alan Romberg noted that "the next step" centers on the talks now being undertaken by Habib in Jerusalem to try to answer questions and objections that Israeli Prime Minister Menachem Begin's government has about specific parts of the plan. Although U.S. officials cautioned that these obstacles are considerable, Romberg said:

"We welcome the Israeli Cabinet's action as an essential element in settling the problem, and we are encouraged that the momentum of the negotiations continues to build. . . . We are cautiously optimistic that the remaining issues with regard to West Beirut can be worked out soon and that we can move to implementing a withdrawal expeditiously."

A similarly upbeat assessment came from deputy White House press secretary Larry Speakes, who also reiterated U.S. willingness to send troops to Lebanon for a period of roughly 30 days to help with the evacuation and give the Lebanese central government time to reassert control over the beleaguered city.

"I would anticipate that, yes," Speakes said in answer to questions about a U.S. military role. Romberg acknowledged that, while the Lebanese government has not yet followed up President Reagan's offer with a formal request for the troops, the United States is proceeding with "the necessary contingency planning" for American participation in a projected multinational force that also is expected to include French and possibly Italian soldiers.

Shimon Peres, leader of Israel's opposition Labor Party, said after a brief meeting with Reagan that the president believes "we are very near to solving the Beirut problem" and then moving on to a new attempt to revive the wider Mideast peace process.

Peres said he too believes the Lebanon crisis is moving toward a diplomatic settlement and added: "I would say it's a matter of a week or two."

That appeared to be in accord with the private assessment of administration officials who said last week that if Habib could get negotiations going without major interruptions, it would take roughly two weeks either to complete a plan and get the PLO out or to conclude that a negotiated solution is not possible.

At that time, the administration, concerned that heavy Israeli assaults on West Beirut were impeding Habib's efforts, appeared to be moving toward a confrontation with Begin. However, starting just before last weekend, Habib's persistent prodding of the various factions in the Lebanon struggle began to show signs of breakthrough; and in the last three or four days rising optimism has been detectable in administration circles.

Administration sources said last night that among the chief problems occupying Habib during his talks in Jerusalem will be a timetable for when the PLO leaves and the multinational force arrives, Israeli reluctance to have French rather than U.S. troops serve as the vanguard of the force, Israel's demand for a detailed accounting of the PLO fighters in Beirut and tying down still tentative agreements about which Arab countries will receive the evacuees.