CONGRESS HAS BEEN doing well in its tormenting struggles with the budget -- better than much of Congress itself expected. There were many lugubrious predictions of breakdown last spring, in the long and wearing process of writing a budget resolution. But in the end a budget resolution emerged -- and a very creditable one. Then the Supreme Court knocked the automatic enforcement mechanism out of the legislation that was forcing down the deficit. One immediate question was whether Congress would have the stamina to vote the billions of dollars' worth of spending cuts that the automatic formula had imposed last winter, and that the court had retroactively voided. There were a lot of angry lobbies ready to fight for the money. But last week, without hesitation, both houses voted to reaffirm those cuts.

Now it gets a little harder. Last month's resolution established a budget for 1987 that was supposed to hold the deficit to $142.6 billion. But disappointing economic growth and shifting estimates of spending have made that figure much too optimistic. And the Gramm-Rudman-Hollings Act still says that the legal limit for the deficit is $144 billion.

One way to comply is to return to the traditional fighting over appropriations. Another is to try to rebuild the G-R-H legislation in a way that the courts will accept. It means reinstalling a device that says to Congress: if you don't agree promptly on a way to get the deficit under that limit, you will trigger blind cuts across the board to do it for you. Without this kind of coercion to evoke the courage of desperation, the advocates of G-R-H fear, Congress will never bring itself to vote for the kind of deficit reductions now needed. There's also the possibility that, if Congress relies on conventional procedure, President Reagan would veto any cuts in defense.

The authors of the original act, Sens. Gramm, Rudman and Hollings, propose a remedy -- although not a very reassuring one. As they first wrote it, the comptroller general, who works for Congress, was to have calculated the precise cuts under the automatic formula and imposed them. But that, the court objected, is an executive function. The three senators would meet the objection by substituting the Office of Management and Budget -- that is, the White House -- for the comptroller general.

That idea needs the closest and most cautious examination. Sen. Gramm says that OMB's function would just be a green-eyeshade calculation. Sen. Rudman is more realistic when he concedes that OMB would inevitably have some discretion in allocating cuts. He counts on public opinion to supplement whatever constraints Congress can write. That doesn't sound like a sure bet.

There's the dilemma of the automatic cuts. Congress can't administer the budget itself. But it can't afford to give much latitude to a president who has never taken the budget deficit seriously, or put its reduction high on his list of priorities.