When President Reagan and his top foreign policy advisers assembled Sunday afternoon in the White House, Ambassador Philip C. Habib told them that Philippine President Ferdinand Marcos was losing control, with the economy a "mess," the church against him and military defections mounting.

"We'd come to the conclusion -- it was a foregone conclusion that he had to go," said a participant. But in the hours that followed, events unfolded even more rapidly than Reagan and his advisers had anticipated, leading to Reagan's climactic statement early yesterday calling on Marcos to yield power.

Sunday afternoon, the officials had discussed a cautious approach to the end of the Marcos regime. While publicly threatening a cutoff of U.S. military aid if violence broke out, the officials privately considered making what one called a "gentle" query to Marcos to determine if he was ready to leave, offering him and his family possible refuge in the United States. But 12 hours later Reagan issued a blunt statement demanding that Marcos give up his 20-year rule.

What sparked the extraordinary demand was an intelligence report from the Philippines received here about 4 a.m. The report indicated that the Philippine armed forces chief of staff, Gen. Fabian Ver, a Marcos ally, was preparing an attack on two military leaders who had asked Marcos to resign, former defense minister Juan Ponce Enrile and the former deputy chief of staff, Lt. Gen. Fidel Ramos.

"It appeared there was going to be force used. There was the expectation of troop movements," said one official. Another top official noted the Marcos-Ver disagreement over military plans broadcast on Philippine television the night before. "We were afraid he would move in a heavy-handed way."

As a result, the White House tossed out the approach it had developed earlier Sunday, officials said, and decided that only a strong statement from Reagan could forestall the attack and prevent further bloodshed. It was the climax of a series of increasingly critical statements from Reagan, who had at first played down reports of fraud and violence by the Marcos regime in the Feb. 7 election.

Reagan was telephoned at 5 a.m. yesterday by national security affairs adviser John M. Poindexter and White House chief of staff Donald T. Regan and asked to approve a statement warning that "attempts to prolong the life of the present regime by violence are futile."

The statement went further than any previously from Reagan by saying that a "solution" to the Philippine crisis "can only be achieved through a peaceful transition to a new government."

Reagan approved the statement and, before dawn here, presidential spokesman Larry Speakes began telephoning it to television networks and wire services to get the word to the Philippines.

One indication of how important television has become to the exercise of diplomacy in this episode came as Speakes then sought to reinforce the message by granting unusual personal interviews to the U.S. morning broadcasts, which usually feature interviews with other administration policy-makers.

If Marcos does not step down, Speakes told ABC's "Good Morning America," then "it would be a situation that would certainly have the potential for violence. It would be a dangerous situation . . . . "

This was a marked shift from Sunday afternoon, when Speakes said it was not the U.S. "prerogative" to seek a transfer of power in Manila. Speakes had made that comment following a National Security Council meeting at which Reagan's top advisers had privately reached the consensus that Marcos could not retain power for long.

Habib, describing his talks with church, business and political leaders in the Philippines last week, cited opposition in the church and military defections as the two critical factors bringing Marcos down.

But the trouble-shooting ambassador also said that Marcos could well resist being removed from office. Reagan's top advisers discussed at length how to bring the word to Marcos that his rule should end without provoking a backlash. "We recognized the situation," said a senior White House official. "But it was a question of how to present it to him [Marcos]. We wanted to convey it in a gentle and tactful way."

Specifically, the official said, Reagan thought at this point that "it was important that Marcos be asked" if he wanted to leave, "not told" that the United States was pushing him out.