Gen. Alexander Haig's chances to be secretary of state were fading into oblivion when Senate Democratic leader Robert Byrd unwittingly came to his rescue with an attack perceived by Republican senators as endangering not merely one Cabinet prospect but Ronald Reagan himself.

Haig seemed finished after Senate Republican leader Howard Baker slipped Reagan's agents a private memo detailing Senate confirmation problems posed by Haig's Watergate background. It was then that Byrd jumped to the attack. Always eager for his regular Saturday news conference to yield a headline, Byrd scored in the Sunday newspapers of Dec. 7 when he warned that Haig would face deep trouble in Senate confirmation.

Seasoned Washington operatives on the Reagan transition team quickly relayed word to the president-elect back at Pacific Palisades: he simply could not let Bob Byrd pick his Cabinet for him. Having smelled a little blood in previous small victories over Reagan, the Senate sharks were encouraged to attack again. Furthermore, throwing Haig's carcass overboard would only prompt fresh attack from senatorial carnivores.

Just as the Soviet Union can be counted on to test a new American president, so does congress. The attack on Haig, regardless of its merits, was a test of Reagan's willingness to stand up to senatorial bullying. If he would not stick to the man he had selected for secretary of state, he scarcely could be expected to confront senatorial arrogance in years to come.

That selection had been pondered by Reagan's closest advisers long before the election. Haig was by no means the choice of the right. Anti-detentists feared his old connection with Henry Kissinger and resented his ambiguous testimony in the 1979 Senate ratification hearing on SALT II. h

Even after industrialist George Schultz took himself out of consideration, Haig was not secure for the State Department. One of Reagan's most trusted advisers paid the president-elect a confidential visit to warn of the luggage carried by the general: the Kissinger connection, his role in arranging the Nixon pardon and those hours and hours of recordings of confidential discussions between President Richard Nixon and his trusted chief of staff, Al Haig, over Watergate-defense strategy.

Reagan persisted. He admired Haig's record as NATO commander and liked him personally. Haig was set for the State Department when the New York Times of Dec. 4 carried a column by Anthony Lewis condemning Haig as a "careerist" with "no feeling for American constitutionalism."

That caught the eyes of Baker, soon to be majority leader of the newly Republican Senate. He delegated his legislative assistant, Howard Liebengood (soon to be Senate sergeant-at-arms) to list the arguments that would be raised against Haig in confirmation hearings. Liebengood's document became a formidable weapon against the general.

The mood in the Republican cloakroom grew sour. Senate Republican Whip Ted Stevens told associates that putting a military man in the State Department was bad policy. The mood was transferred to Reagan's own aides. "Why do we need this rock in our knapsack?" asked one. As the weekend of Dec. 6-7 approached, Haig's prospects were adjudged at no better than 50-50 by Reagan insiders.

But more than Haig was at stake. In the month since the election, Reagan had permitted himself to be shoved around by the Senate grandees. He had acquiesced in plans (later scuttled) to pass a tax cut not his own; he had not pressed his own opposition to lame duck passage of the "Superfund" bill against toxic wastes; he had permitted Senate opposition to force out his choice as Treasury secretary, William Simon.

While Jimmy Carter's defiance of Congress proved fatal, subservience by Ronald Reagan would have the same result. The abandonment of Haig would have branded Reagan nearly two months before Inauguration Day as a president who can be bullied.

That was when Byrd came to the rescue, with so frontal a challenge to Reagan as well as to Haig from the leader of the Senate's Democratic minority. Whereas private memoranda by Howard Baker could not be depicted by Reagan agents as undermining presidential authority, public threats by Bob Byrd certainly could.

Reagan's men now argued with Republican senators that it was intolerable that Byrd or New York Times columnists or even Republican senators were picking Reagan's Cabinet. It was past time, they added, to bury the politics of Watergate. Soon, key senators -- including that independent-minded Democrat, Henry Jackson -- put out the word that Haig surely could be confirmed. The battle was over when Baker publicly put himself on Haig's side.

By good luck mostly, Reagan had survived a severe congressional test. There is no serious doubt that Haig will be confirmed, possibly without much trouble. It is a lesson for the president-elect to ponder as he confronts senatorial obstacles to his radical plans for reform of taxes, the budget and the national defense that will determine the fate of his presidency.