President Reagan said yesterday that he has agreed to a request by the Lebanese government to send a contingent of U.S. Marines back into Beirut for a "limited period of time" to help give stricken Lebanon "a chance to stand on its own feet" and to bring to an end the "long nightmare" of its agony.

For the second time in three weeks, the president went on national television to dramatize his call for an end to the bloodshed in Beirut as the first step in a broader peace between Israel and its neighbors in the Arab world.

The president spoke amid rising condemnation worldwide about the slaughter of Palestinian refugees in Beirut last weekend, allegedly by Lebanese Christian militiamen and for which Israel is drawing much of the blame.

Approximately 800 Marines will again be joined by military units of similar size from France and Italy, whose troops also oversaw withdrawal of Palestine Liberation Organization fighters from Beirut earlier this month after Israeli forces encircled the city. The reaction in Congress was of unenthusiastic approval.

For the multinational force to succeed, Reagan stressed, the Lebanese government must assume responsibility for the country's internal security and therefore "it is essential that Israel withdraw from Beirut." Reagan, who aides say was horrified by the massacre at two refugee camps, also warned:

"Israel must have learned that there is no way it can impose its own solutions on hatreds as deep and bitter as those that produced this tragedy. If it seeks to do so, it will only sink more deeply into the quagmire that looms before it."

U.S. officials have requested Israeli permission to have the force reenter Beirut. The Israeli Cabinet is to meet today on the request and is expected to agree, according to U.S. officials and Israeli state radio.

In Israel, controversy and tension grew over its role in the events that led to the killings in the Shatila and Sabra camps. Two Israeli newspapers reported that government officials were aware 36 hours before they intervened that civilians in those camps were being killed by Christian units allied with Israel. Government officials disputed the accounts, and Israel has denied responsibility for the killings.

Under rising pressure and criticism at home and abroad over its actions in Lebanon, Israel has reportedly begun pulling troops out of Beirut. Paradoxically, this reportedly caused some residents in one section of the city to flee in panic yesterday amid rumors, apparently unfounded, that Christian militiamen were returning.

In Cairo, the Egyptian Foreign Ministry announced the recall of its ambassador to Israel as "an expression of resentment" over Israeli actions. While Egypt stopped short of harsher moves, the action endangers Israel's relations with the only Arab state that recognizes its existence.

Soviet President Leonid I. Brezhnev also condemned Israel, laid partial blame on the United States for having "encouraged" Israel's "criminal aggression" and proposed joint U.S.-Soviet action to curb Israel.

Jordan's King Hussein accused Israel of being responsible for the massacres but seemed to go out of his way to urge a positive Arab response to Reagan's proposal in his long-range Mideast initiative to remove all foreign forces from Lebanon and negotiate a settlement to the Palestinian question.