The Senate, in almost five hours of debate haunted by the failure of Braniff International, voted yesterday to buy used Boeing 747s instead of the Lockheed C5 cargo planes sought by the Air Force to bolster its airlift capability.

The Air Force wanted to buy 50 more new C5s, but Sen. Henry M. Jackson (D-Wash.) said it would be cheaper to purchase the 747s, starting with used planes not needed by economically stricken airlines.

An amendment to require purchase of the Boeing planes passed on a voice vote after an effort to table the amendment failed, 60 to 39.

Senators also voted, 63 to 32, to table--and thus kill--an effort by Sen. Gary Hart (D-Colo.) to delete one of two nuclear-powered aircraft carriers from the defense authorization bill to save $3.69 billion in multiyear spending.

Hart then lost, 72 to 19, on an amendment under which money earmarked for one of the 93,000-ton carriers would have been used to build two 44,000-ton conventionally powered carriers.

A measure by Sen. John Glenn (D-Ohio) to scrap the MX missile on grounds that no basing method has been found for it was tabled, 65 to 29. Glenn would have diverted the $565 million earmarked for the weapon to research on a new, smaller missile developed with a mobile basing system in mind.

Glenn said the MX had been plagued by a series of unworkable proposals on how to keep it safe from surprise Soviet attack. Opponents said it would be foolish to abandon the $3 billion investment already used in development of the MX.

Several basing plans have been suggested for the MX missile, but none has attracted wide support.

Earlier, the Senate took about two hours to dispose of three non-controversial amendments, including a measure asking President Reagan to seek agreement with North Atlantic Treaty Organization allies on greater coordination of their defense industries to avoid duplication of effort.

The debate came as the Senate continued a slow pace toward approval of the $177.9 billion defense authorization bill for fiscal 1983. Leaders said the chamber would stay in session all night if necessary.

Sens. Jackson and Slade Gorton (R-Wash.), in whose home state Boeing Co. is located, led the effort to set aside purchase of more C5 planes in favor of the 747.

Debating them about the relative merits of the two planes were Democrat Sam Nunn and Republican Mack Mattingly of Georgia, where Lockheed produced the current generation of C5s in Marietta and where more would be produced if Congress authorized them.

Senators from Missouri and Kansas allied themselves with the Washingtonians in the debate. McDonnell Douglas Corp. of St. Louis had proposed building a new transport plane, the C17, but the Pentagon rejected it in favor of the C5.

The Senate Armed Services Committee, on which Jackson and Nunn serve, had voted to obligate $800 million to buy the first of 50 new C5s in accordance with the administration's request.

Citing Boeing statistics, Jackson and Gorton said buying surplus 747s from financially troubled airlines and converting them to haul military cargo to distant troublespots would save $6 billion over the long term.

They also argued that the 747 also can fly longer distances and carry a heavier payload than the C5 and that the 77 C5s already in the inventory are sufficient.

But Nunn and Mattingly said only the C5 can carry such "outsize" items as tanks, large trucks and artillery pieces that U.S. forces would need immediately in a combat zone.

They also produced visual aids in support of another argument--four huge color photographs showing that military vehicles can drive up a ramp directly onto a C5 while cargo must be lifted 16 feet off the ground to be placed into a 747.

A C5 supporter, Sen. Barry Goldwater (R-Ariz.), said Pentagon estimates show that the lifetime cost of a 747 fleet would be only $1 billion cheaper than the Lockheed plane. "And the C5's flexibility is clearly worth the extra cost," he said.

Both sides agreed that the Air Force needs at least 50 more large cargo planes to fly the U.S. Rapid Deployment Force to any world troublespots.

Backers of the Boeing plan were handed unexpected ammunition with the announcement that Braniff International has ceased operation because of financial problems and has begun bankruptcy proceedings.

But Nunn said the Braniff developments should not affect the Senate's decision. "For our votes to be influenced today by headlines about Braniff airlines would be very, very shortsighted for our national security," he said.