For at least three hours after Egyptian President Anwar Sadat was assassinated last week, the White House was being told by Egyptian authorities and American diplomatic and intelligence officials in Cairo that he was still alive, and the Reagan administration was reacting to the crisis on that basis, according to knowledgeable administration sources.

These sources also revealed that the CIA has begun a comprehensive investigation of the episode. The main goal is to determine if there was any involvement, direct or indirect, in the assassination by foreign powers such as Libya.

In addition, the report also is to assess the U.S. response during the unfolding crisis. The report is expected to be presented to the White House in about two weeks.

In addition, the sources said that President Reagan and Vice President Bush stayed away from the Sadat funeral partly because the Libyan ruler, Col. Muammar Qaddafi, had discussed possible assassination plots against Reagan with "some of his friends," and that these conversations had been picked up by U.S. intelligence.

The alleged threats against Reagan reportedly came around the time of the August aerial dogfight over the Gulf of Sidra during which U.S. carrier jets shot down two Soviet-built Libyan warplanes.

Officials close to the situation say Reagan and other top U.S. officials first heard that Sadat was dead from American television reports.

These reports, coming amid the chaos and confusion of the attack on Sadat, were labeled immediately as invalid by Egyptian leaders and the American Embassy in Cairo.

The sources said there were two main reasons for the confusion and uncertainty about whether Sadat was dead or alive in those first crucial hours.

One key reason why Washington believed Sadat was still alive was an incorrect eyewitness assessment that he was only slightly wounded. The assessment was telephoned to the State Department by the U.S. ambassador to Cairo, Alfred L. Atherton Jr.

Atherton, who was on the reviewing stand, is understood to have thought Vice President Hosni Mubarak was gravely wounded and carried out of the reviewing stand on a stretcher, and not Sadat.

The sources stressed that, in the turmoil at the scene, with everybody ducking for cover, such confusion was understandable. Mubarak and Sadat were wearing military uniforms and were seated next to each other. The senior CIA official in Egypt reportedly was not at the parade site.

The second major reason for the delay in learning that Sadat had been killed was that the tiny circle of Egyptian officials who knew what was happening were continuing to tell the American Embassy that Sadat was still alive long after he had died from multiple wounds.

They did so for what U.S. officials presume to be understandable reasons: to gain a little time to settle down and figure out what to do next.

Though the assassination of Sadat stunned American leaders, who had spent millions of dollars in recent years to protect the man they considered one of the central American allies in the Mideast, the killing did not set off a panic in Washington because there were no visible signs of a breakdown of political order in Egypt.

Some administration officials said that if the assassination had been linked to an attempted overthrow of the government, or an invasion by foreign armies, this would have been quickly apparent, and that the Egyptian authorities would have reacted right away and informed the Americans.

Similarly, these sources said that key portions of the Egyptian government, including the police, military authorities and other security and intelligence forces, were in place.

Officials explained that in a coup the security apparatus is usually the first thing that would break down or show signs of upheaval.

Sources say they believe that the United States, via a telephone call from Egyptian officials to Atherton, was the first government informed about Sadat's death after the decision was made to acknowledge it.

White House officials are known to be disturbed by the confusing and belated intelligence reporting from Cairo in the chaotic hours after Sadat and a number of spectators were showered with automatic weapons fire and grenade shrapnel by four military-garbed assassins who attacked at 7:10 a.m. Washington time.

One official who is familiar with the ensuing sequence of events said the first report from the scene was telephoned in by Atherton. "The first report had Mubarak appearing to be gravely injured . . . and carried off on a stretcher," the official said.

"As a matter of fact, in the first hour, we thought he was the most seriously wounded." At the same time Atherton reported that Sadat was standing and had suffered a wound in his side and one in his hand. "As it turns out, they were essentially reversed," the official said.

Atherton raced to the U.S. Embassy and made the first full report of events to the State Department on a secure telephone line, which remained open throughout the morning.

When Sadat arrived at a military hospital at nearby Maadi 10 minutes after the shooting he was reported to be in a coma, with no detectable heartbeat and with blood streaming from his mouth.

There were two bullet wounds in the left side of his chest, one in the neck and another above his right knee. One thigh was gashed, and the thigh bone seriously fractured.

Despite the apparent hopelessness of Sadat's condition, Egyptian doctors continued attempts to revive him for about 80 minutes before they pronounced him dead, privately, at about 8:40 a.m.

Later, at 9:57 a.m. Washington time, former president Jimmy Carter was interviewed by CBS News and said that he had been told by sources in Cairo that Sadat was alive and had suffered "no life-threatening wounds."

Within an hour, however, CBS aired the first report that Sadat was dead. It came at 10:26 a.m. from its Cairo bureau manager, Scotti Williston. Williston attributed these reports to separate sources at the Maadi hospital.

When the CBS report was aired, government sources here said that it was widely regarded as accurate. Top-level sources, however, say the Egyptians in Cairo and the U.S. Embassy there continued to send information until past 11 a.m. Washington time that Sadat was still alive, though his condition could no longer be determined.

Officials said that soon after the unofficial reports of Sadat's death a task force set up in the State Department began focusing on a new set of questions. These included how best to support a new Mubarak regime, how to keep the Israelis from panicking and how to keep the Soviets and Libyans from exploiting the situation quickly.

"We're not proud," one senior official said in acknowledging that CBS had scooped the U.S. diplomatic and intelligence community. Their point is that, in a rapidly evolving crisis, it is frequently the news media, with more representatives on the scene, that can find out most rapidly what is happening.

It was still not clear this week precisely when the White House officially confirmed Sadat's death. Egyptian officials formally notified U.S. officials of Sadat's death at 12:30 p.m. Washington time, according to one knowledgeable source.

But it was clear from a statement by Senate Majority Leader Howard H. Baker Jr. (R-Tenn) on the Senate floor at 11:34 a.m. that American officials had received some formal word that Sadat was dead. Baker cited Bush as his source.

White House spokesman Larry Speakes said yesterday that he did not know when Reagan heard the first report of Sadat's death. He also declined to comment on the reports of alleged threats by Qaddafi against Reagan, which were first reported yesterday by syndicated columnist Jack Anderson.

Secretary of State Alexander M. Haig Jr. and other U.S. officials have said publicly that thus far there is no evidence of any foreign involvement in the assassination.

Here and in Cairo the attack is being attributed to a small group of fanatical Moslem fundamentalists. The White House, however, is known to remain extremely suspicious of Qaddafi, and thus anxious for a thorough investigation of any possible foreign involvement.