In a major victory for Northern Virginia and other urban areas, the state Senate agreed today to a sweeping proposal to divert millions in highway money from the once politically powerful rural areas of the state.

But the euphoria of legislators from the Washington suburbs was cut short when some senators who support the highway changes warned that state money for the Metro transit system may be cut dramatically next year. The funding could be more vulnerable next year after one of Metro's staunchest supporters, Gov. Charles S. Robb, leaves office.

The bill would increase the amount of highway money going to the Washington suburbs from $41.4 million to $45.5 million a year, increasing the likelihood that work could begin on many long-sought projects, such as the Springfield bypass in Fairfax County. Most of the increased funding is likely to be used for improving secondary roads in the region, many of which were built before the Washington suburbs were extensively developed.

The House approved earlier this session most of the changes voted by the Senate today. It is expected to endorse the Senate's revisions and send the bill to Robb, who has said he will sign it into law.

The Senate's once-powerful rural coalition crumbled today under the pressure of a combination of suburban and urban legislators, including Sen. Edward E. Willey (D-Richmond), chairman of the Senate Finance Committee.

The 29-to-11 vote in favor of changes in the state's $1 billion highway fund came after one of the bitterest and most emotional debates of the 1985 session. The Senate, which prides itself on its gentlemanly manner, erupted into acrimony and regional name-calling throughout the two hours of arguments.

"Giving money to Metro is like pouring soapsuds down a rat hole," charged Sen. Madison E. Marye, a Democrat from Southwestern Virginia.

"Our region is becoming the whipping boy for the commonwealth, and I'm getting tired of it," shot back Sen. Charles L. Waddell (D-Loudoun).

It was the second time in the current session that rural lawmakers opposing the highway fund changes have attacked the $21 million-a-year state government contribution to Metro. And for the second time, it was the influential Willey, the senior member of the legislature, who stepped in to head off the effort.

But though he sided with Northern Virginians over Metro funding this year, Willey said he was merely trying to preserve the delicately drawn highway funding bill and next year may lead attempts to eliminate Metro funding.

"I'm not particularly pleased with giving funds for Metrorail," said Willey. "But what they [the Metro opponents] are trying to do with this bill is absolutely wrong. It's not the way to do business in the General Assembly."

"This is the one we wanted to win," said Sen. Clive L. DuVal II (D-Fairfax), who led the Northern Virginia delegation in its fight for the highway fund changes. "But we're going to have to worry about Metro funds, obviously."

Waddell said today's action, coupled with approval of other bills that would allow localities to spend an unlimited amount of their own money on road improvements, has given Northern Virginia "more to address crucial transportation needs than any time in modern history."

Although urban legislators have long attempted to change the road money formulas they claimed discriminated against populous areas, this was the first year they came to the legislature with enough clout to force changes in spending rules that date from the time rural legislators controlled the General Assembly.

Supporters built a solid coalition through compromises that benefit some rural counties as well as virtually every city and densely populated county. They expected their toughest battle in the Senate, where many districts include both urban areas that won new money under the formula and rural areas that suffered.

"You're taking from the poor and giving to the rich," said Sen. Daniel W. Bird Jr., a Southwestern Virginia Democrat, prompting the chamber to break into applause. "We'll live, we'll survive. But at the same time you're hurting us bad."