President Carter announced yesterday that he will ask Congress to continue $2.3 billion a year in grants to states under the federal revenue-sharing program. He had earlier said he doubted that the aid was really needed.

The decision, which had been disclosed previously, was announced with fanfare by three top White House officials, domestic adviser Stuart H. Eizenstat, budget director James T. McIntyre and urban affairs chief Jack Watson.

The announcement marked on election-year victory for state and local government officials, who had been lobbying intensively to retain the aid to states as part of the $3.9 billion general revenue-sharing program up for renewal this year.

However, the grants involving states still face an uncertain future in Congress. Rep. Jack Brooks (D-Tex.), chairman of the House Government Operations Committee, wants to eliminate the state aid. So do several key senators.

The major rationale for scuttling the aid to states was that slates, unlike counties and cities, have the taxing power to raise whatever money they need.Most states have been in sound fiscal condition in recent years.

Eizenstat conceded at a briefing that Carter "had in the past expressed some reservations about the state share," but he said officials feared that the entire program might fall through if the state-local "coalition were fragmented."

At the same time, McIntyre denied that the decision was political. "This wasn't a cave-in to the governors or to anyone else," he said. "The decision was made after a great deal of study and analysis."

Congress must act this year if it is to renew the federal revenue-sharing program, which was enacted in 1972 after being proposed by the Nixon administration. The White House said yesterday that Carter will seek a five-year reauthorization.

The program provides no-strings grants to states and localities, distributed according to complex formulas. A third of the $3.9 billion-a-year total goes to the states, while the rest goes to countries and cities.

The idea behind the revenue-sharing concept was to remove Washington from direct decision-making about how states and localities spend federal monies. The grants to states were tacked on by Congress as a political compromise.

Officials served notice yesterday that Carter still has not made final decisions on several key details of the program, such as whether to recommend elimination of some smaller counties and special-purpose jurisdictions, such as highway administrations.

However, these are expected to be relatively minor. And officials confirmed yesterday that Carter will continue antirecession aid to states at a $1 billion level in his new fiscal 1981 budget, more than offsetting any cuts.

Carter also added in yesterday's proposal, presumably as a gesture to Capitol Hill opponents, a plan that would require states to set up commissions to study ways to improve their financial positions and channel more aid to localities.

However, that may not be enough to placate opponents. Opposition to including states in the revenue-sharing pie is strong. Many want the money for other programs.

Reactions to the president's announcement yesterday was predictable, with both major groups that pushed for Carter's decision -- the National Governor's Association and the National League of Cities -- praising the move.

However, Brooks in a statement issued by his office here, charged that Carter "has apparently yielded to the incessant demands of the state and local government lobby" for still more federal aid.

"I hope Congress will show more restraints" when the legislation comes up for consideration, Brooks said. He said that providing grants to states and localities when the federal budget is strapped "sounds silly to me."