U.S. security agencies believe it is too risky for President Reagan or Vice President Bush to visit Cairo for the funeral of assassinated President Anwar Sadat, but the United States is sending an extraordinary delegation that includes three former presidents and three Cabinet members.

Reagan decided the United States would be represented by former chief executives Jimmy Carter, Gerald R. Ford and Richard M. Nixon, all of whom agreed to make the trip.

Reagan expressed "great regret" at not being able to attend the funeral Saturday of a man he hailed Tuesday as "a close and dear friend," White House communications director David Gergen said. Gergen gave only one reason for Reagan's decision--security.

"The security agencies of this government unanimously recommended that he remain here," Gergen said. He added that the same reasoning applied to Bush.

Other officials said that Reagan felt strongly Bush would run the same risks as the president in Cairo, and therefore shouldn't go.

White House deputy press secretary Larry Speakes, asked why former presidents would be safe where sitting presidents should not travel, replied, "One is the president of the United States and the others are former presidents."

The remarkable delegation that will board a U.S. jetliner to Cairo will be headed by Secretary of State Alexander M. Haig Jr., the senior administration representative. He will have the front cabin, which is reserved for the most important passenger on such government planes, both because of his rank and because he will be working, one official said.

In the next compartment, seated together for the long flight, will be what the White House described as the "prominent Americans delegation": Carter, Ford and Nixon. Also aboard will be two veterans of the Ford and Nixon administrations, one in office, one out--Defense Secretary Caspar W. Weinberger and former secretary of state Henry A. Kissinger.

At the State Department, Haig was asked why no women are in the delegation. He replied that women are always close to his heart and then remembered that U.N. Ambassador Jeane F. Kirkpatrick would be on the plane. Rosalynn Carter plans to accompany her husband, but Betty Ford and Pat Nixon will not make the trip.

A bipartisan group of congressional leaders will be on the plane as well.

Even on Capitol Hill, however, security concerns threatened to take their toll among the invited. Senate Majority Leader Howard H. Baker Jr.'s staff persuaded him not to make the trip because of its risks. Of the five invited congressional leaders, only one, Sen. Charles H. Percy (R-Ill.), will attend.

Besides Baker (R-Tenn.), House Speaker Thomas P. O'Neill Jr. (D-Mass.), House Minority Leader Robert H. Michel (R-Ill.) and Senate Minority Leader Robert C. Byrd (D-W.Va.) declined to make the trip for various reasons.

Instead, Sens. Strom Thurmond (R-S.C.) and Claiborne Pell (D-R.I.) will join Percy, while House Majority Leader James C. Wright (D-Tex.) and Reps. William S. Broomfield (R-Mich.) and Clement J. Zablocki (D-Wis.) will represent the House.

Also in the delegation will be Sam Brown, 14, a ninth-grader from Liberty, S.C., who had written Sadat in 1979, praising Sadat's peacemaking efforts and then toured Egypt at Sadat's invitation as a guest of the government.

Initially, the White House press office identified Sam Brown to reporters as the Democratic former antiwar leader who was Carter's director of Action.

Early on, Reagan assured Bush that the vice president would play a major role in the administration by telling him he wouldn't spend all his time going to state funerals.

That Bush, who represented the United States at the funeral of former Venezuelan president Romulo Betancourt last Saturday, is not attending the funeral of the United States' close friend caused some surprise yesterday, but White House officials explained that Reagan was very firm on not exposing the vice president to the risks of Cairo.

As a result, Haig got the nod. At the State Department yesterday, Haig's aides referred to the famous bureaucratic battle of last winter, when Bush won the job as head of crisis management over Haig, and joked: "Well, they're sending the deputy chief of crisis management."