Virginia Gov. John N. Dalton dismayed Northern Virginia legislators today by announcing that he is flatly opposed to a regional sales tax that many say is the best way to finance Metro transit operations in the Washington suburbs.

In his opening address to the General Assembly, Dalton said he opposes proposals for local sales or gasoline taxes for any local governments. "Once that door is opened, other localities would undoubtedly demand the same treatment, which, in the end, would amount to a general tax increase," the governor said.

Although Dalton did not say in his message that he would veto any such measure, William A. Royall, his top aide, said later this was Dalton's intent. "Hell, yes," Royall said when asked if Dalton's message contained the threat of a veto.

The governor's announcement was a surprising blow to legislators from Northern Virginia, who had hoped the Republican governor would at least consider approving such a measure for their area if they could win its approval in the assembly.

But some legislators conceded Dalton had apparently extinguished their hope for a tax proposal similar to one that fell one vote short of passage last year in the face of opposition from the powerful House of Delegates Democratic leaders.

"The governor has missed the whole point of our proposal by referring to it as a tax increase," Del. Richard R. G. Hobson (D-Alexandria) said. "The bill guarantees a dollar for dollar reduction in property taxes to offset any sales tax increase,"

Royall later amended his threat of a gubernatorial veto by saying: "The governor's policy is not to say that he will veto a bill until he sees its final form."

While some legislators clung to the hope they could salvage a Metro tax measure from the Assembly, Senate Majority Leader Adelard L. Brault (D-Fairfax) was pessimistic. "It sounded like a veto statement to me," Brault said. "I'm very upset by it because I don't know any other way we can handle the Metro costs that now are paid out of property taxes."

Defending past support of Metro, Dalton said Virginia has "advanced or committed more than $200 million to Metrorail in state funds or federal funds which state action has made available."

He said the state government "should assist in this area as we have in the past," a policy that would limit state payments to $5 million a year in construction money. Dalton pledged Metro that amount during his 1977 campaign and included the sum in the current, two-year budget.

He also said Northern Virgina could use any future revenue-sharing by the state with local governments for Metro, including an advance in state liquor store profits.

The $5 million in annual construction aid and one-time windfall of about $2.5 million in liquor profits are small sums, however, in comparison with the almost $40 million a year that a penny increase in the sales tax would provide Northern Virginia.

Dalton's sales tax statement caught legislators from the Washington suburbs by surprise, a fact that increased their anguish. Brault had praised the governor last week for consulting the leadership of the overwhelmingly Democratic assembly on his programs, but Brault criticized him today for failing to warn of his tax statement.

"I'm disappointed that he did not talk it over with us. It clearly is directed at Northern Virginia."

Sen. Omer L. Hirst, chief patron of the sales tax measure, said he was aware of the governor's opposition but did not know that Dalton was going to address the issue in his speech, thus stiffening opposition that the Northern Virginia tax measure already faced in the House.

Ironically, Dalton departed from his speech text at the outset to honor Hirst, who is retiring this year as Northern Virginia's senior legislator. Hirst received a standing ovation from the other 139 legislators in the House chamber, but minutes later the governor dimmed Hirst's hopes for achieving one of his major legislative goals -- sound financing for Metro.

For the Northern Virginians, the governor's sales tax statement overshadowed the rest of his speech, which included proposals to spend $47 million in surplus funds and endorsement of state-guaranteed bonds to finance a commuter toll road paralleling the Dulles Airport access road.

In another major policy statement, the governor warned against adoption of various proposals to put a constitutional or statutory ceiling on state spending, proposals that have been advanced after California's adoption of Proposition 13. The California law rolled back property taxes throughout that state and captured the imagination of anti-tax organizations throughout the nation.

Declaring his opposition to tax and spending ceilings, Dalton said, "It is apparent from Virginia's track record that we have not abused the taxing and spending authority entrusted to her elected leaders."

For the first time since he became governor last January, Dalton addressed pressures for new state revenues for cities and counties by proposing that the assembly use $16.2 million of the surplus to finance quarterly payments of state liquor store profits to local governments. This will produce a one-time bulge in payments in the 1979-80 fiscal year, and Dalton said he hopes to propose additional revenue-sharing measures in 1980.

He also recommended that the assembly halt required reductions in public school classroom size, to reduce local government costs by $20.9 million annually by 1982.

In addition to the $16.2 million for local governments, Dalton recommended that the state surplus be used to finance $12 million in new construction projects and $12 million in what he called "housekeeping" additions to the current budget. His proposals left $7 million for the assembly to appropriate for other programs.

The construction projects include $4 million for prisons, most of it for site acquisition and planning for four 500-bed medium security prisons planned to keep pace with the state's rapidly growing inmate population.

Dalton's budget proposals also included about $600,000 needed to meet the state's commitments to the Department of Health, Education and Welfare to complete desegregation of Virginia's public colleges. Virginia and HEW reached a new desegregation accord last weekend as the federal agency was about to start proceedings to cut off more than $75 million in college aid.