President Reagan said yesterday that he found "reasons for some optimism" for an early settlement to end the fighting in Lebanon between the Israeli army and the Palestine Liberation Organization.

Defense Secretary Caspar W. Weinberger, meanwhile, said U.S. special envoy Philip C. Habib has "now been assured" by Israel that there is no specific deadline on negotiating an agreement to get Palestinian forces out of Beirut. But Weinberger said the situation is so complex that even if an agreement is reached it might be August before any withdrawal could take place.

Reagan, flying back to Washington from his California vacation, noted that the United States "has been disappointed before" in efforts to resolve the Lebanese situation.

Questioned aboard Air Force One, the president said he was wary of sending American troops into Lebanon as part of a peace-keeping force but would carry through on his offer to do so "if it was essential to bringing peace to that area" and if several conditions are met with "total agreement" by all parties to the conflict.

The president also disclosed that he had sent a letter to Egyptian President Hosni Mubarak on Lebanon but declined to discuss its contents.

Reagan noted that there has been no formal request for U.S. troops from the Lebanese government. And Weinberger, appearing on "Meet the Press" (NBC, WRC), said if American troops were used to safeguard a withdrawal of PLO forces from West Beirut, the evacuation "should not take more than a few days" and "once that was achieved, we would have them the U.S. forces withdrawn."

The defense chief stressed that the troops "would stay as short a time as possible" and only "for the very limited purpose" of making sure that the PLO could leave the country safely.

Weinberger appeared to clarify a source of confusion about the prospective U.S. military role in Lebanon.

The original White House announcement last week said the mission of those U.S. troops--up to 1,000 of them--"would be to assist Lebanese armed forces in the orderly and safe departure from Beirut of armed personnel, and to assist in the transition of authority to the Lebanese government in Beirut."

Yesterday, however, Weinberger took the narrowest interpretation of the mission, saying, "The use of the troops would be entirely for the first purpose. We would not have, or contemplate having, U.S. troops remaining in Beirut or in Lebanon until the full authority of the Lebanese government has been restored."

Restoring such authority could take some time, Weinberger said, and would lead to a "totally open-ended, indefinite commitment and, as I understand it, our acceptance of the use of U.S. troops is for the very limited purpose of getting the PLO out . . . . "

There was no specific White House comment yesterday on the Weinberger interpretation. On the Reagan plane, deputy White House press spokesman Larry Speakes said the U.S. role is "not finally or firmly determined," but his comment did not come in response to a question about what Weinberger had said.

Weinberger said he could not confirm reports on Israeli radio that Habib had set an Aug. 1 deadline as an informal target date for the PLO withdrawal. But he said it seemed "a rather realistic assessment of the time it would take" to bring together the complex array of a dozen or more factions in a negotiation being carried out under extremely difficult conditions. Reagan told reporters on the plane that Habib had not set any deadline.

Israel's ambassador to the United States, Moshe Arens, said yesterday he thought the talks attempting to arrange a PLO withdrawal were leading "nowhere," that PLO leader Yasser Arafat was stalling for time, and that Israel would not wait indefinitely for the withdrawal issue to be settled through negotiations.

Arens at first said there was a deadline but later said he knew of no specific date that had been set.

Arens appeared on "This Week with David Brinkley" (ABC, WJLA), as did Sen. Christopher J. Dodd (D-Conn.), who has been visiting Lebanon. Dodd also indicated he wasn't convinced the PLO was negotiating in good faith. "I'd be less than candid if I said I thought the PLO was going to withdraw peacefully," he said.

On the other hand, the Lebanese ambassador to the United States, Khalil Itani, told interviewers on the same program that "a great deal of progress has been achieved so far" in the attempts to negotiate a PLO withdrawal from West Beirut, which is ringed by the Israeli army.

"As far as I know, and on the basis of information I received from well-informed sources, I can say that a final agreement should emerge in the next few days if not the next two days," the ambassador said. He declined to provide details because, he said, that could jeopardize the talks.

Sen. Charles H. Percy (R-Ill.), the chairman of the Senate Foreign Relations Committee, said yesterday that he had "deep reservations" about the sending of American troops to Lebanon, and that it should be done only under the most stringent conditions.

Percy, in an interview on "Face the Nation" (CBS, WDVM), said he would express his concerns on this matter to Reagan Tuesday when the president meets with congressional leaders on the Middle East situation.

Although Weinberger, as he has in the past, suggested displeasure with the actions of the Israeli government of Menachem Begin, it was Percy who was by far the most critical of the Israeli government of Begin and defense minister Ariel Sharon.

The senator said the controversial invasion of Lebanon could turn out to be "Israel's Vietnam." He said relations between this country and the Jewish state were at their lowest ebb in 25 years and that Israeli leaders must be "realistic" and recognize that "world attitude, American attitude is changing against it."

Percy, speaking of what he said was a pledge of "no surprises" between the United States and Israel, said, "I feel most strongly about what I consider a pledge broken, a pledge between partners, between friends. It's a serious thing."

Percy said figures supplied by the Lebanese ambassador indicated that 14,000 civilians had died and another 55,000 had been injured in the war thus far.

Arens acknowledged that he was deeply disturbed by what he called "a campaign of vilification against Israel the kind of which we've never seen before."