Virginia's 140 lawmakers arrive here this week to face the unpleasant choice of raising taxes or cutting aid to public schools--neither of which will help them get elected next November.

It is a politician's nightmare, brought on by a lingering recession that has shrunk state revenues and left a record deficit in Virginia's two-year budget. That gap--now projected at $162 million--is expected to dominate all 46 days of this year's legislative session.

"I suspect we will have a fairly somber, realistic session," said Gov. Charles S. Robb last week. "I think there is a pretty widespread acceptance of the gravity of the situation."

Robb, proposing to amend a $13.7 billion biennial budget he inherited when he took office a year ago, will break the bad news officially in a speech to a joint session of the legislature Wednesday night. Although none of his proposals has been made public, Robb is not expected to endorse any major tax increases--a decision that would be warmly received by the legislators.

"I think we have got to bleed for a little while before there is support for a tax increase," said Del. Warren Stambaugh (D-Arlington), a member of the House Finance Committee.

The alternative to new taxes seems inevitably to involve the state's giant $3.2 billion contribution to local governments, most of which--$2.3 billion--goes to public education.

Politically, any assault on local aid is equivalent to slaughtering a sacred cow in Virginia, and the suggestion of such cuts already has prompted protests across the state.

"We'll empty out those state buildings in Richmond before we touch local aid," vowed state Sen. Richard L. Saslaw (D-Fairfax), while House Minority Leader Vincent F. Callahan Jr. (R-Fairfax) said, "Any cuts like that will be vigorously opposed.".

While the budget gap will consume most of their attention, Virginia legislators also will have a chance to vote on more emotional issues--such as measures to raise the legal drinking age to 21 on all alcohol and a series of controversial anticrime bills submitted by Robb.

The Alcoholic Beverage Control Commission is considering a bill to create a two-tiered pricing system on hard liquor across the state so that Northern Virginia outlets, for example, could compete more effectively with the lower prices of Washington liquor stores.

The most dramatic battle of the session will be between the railroad and utility lobbies over a $650 million proposal to transport coal by pipeline from Southwest Virginia mines to Tidewater port cities. But the pipeline, like many other sensitive issues, may wind up being postponed until after the elctions this fall.

The short mid-budget session--six weeks, compared to last year's eight--promises to be more politically charged than usual as legislators scramble to get at least one bill passed before their fall campaigns, said Sen. Wiley F. Mitchell of Alexandria. "It's going to be more hectic, more difficult to give thorough attention to important legislation, people are going to get more angry and the possibility of good bills passing is reduced."

For many local government lobbyists, the mission this year will not be to get new programs passed, but to protect programs already in place. Northern Virginians, who last year won a substantial increase in state aid for the Metro regional transit syustem, are not expecting to match that coup this year.

"This time, we're going back and saying 'Just don't cut us, hold the line,' " said Jay D. Jacobs, lobbyist for Fairfax County public schools. "It's the first time we have been in that position."

Robb spared school aid and other contributions to local govenrments last spring when he ordered a 5 percent cut in state agency spending. But with no break in the gloomy forecasts for the state's economy, many Democratic leaders in the General Assembly say Robb may not be able to exempt education and local governments from the belt-tightening ahead.

"Those of us who hoped the deficit wouldn't go this high were hoping we could resist cuts in public education," said Senate Majority Leader Hunter B. Andrews (D-Hampton). "But now, I don't know how we can avoid it with this type of shortfall."

Any cuts in education are going to be particularly touchy for Robb, who during his campaign and his first year in office stressed the need to improve Virginia's low national rank in spending for public schools. Last year, Robb was able to convince the legislature to increase education spending for the specific purpose of raising teachers' salaries 10 percent a year.

This year, many Democrats say they will try to hold Robb to his promises. "I am assuming his commitment to public education is so great that he will not cut aid to edcuation," said Del. Mary Marshall (D-Arlington). "I would think that would be last on his list."

The last time Virginia cut local aid was during Gov. Mills E. Godwin's tenure under circumstances remarkably similar to those facing Robb now. In the midst of the economic slump in 1977, Godwin halted capital projects, as Robb has done, and ordered a 5 percent cut in state spending, including local aid.

Republicans this year have expressed some skepticism about the Robb administration's gloomy economic projections. Callahan, for instance, expects to see an upturn in the economy and a corresponding increase in anticipated tax receipts. "Then Robb will be able to add money and he will come out looking like a big hero," said Callahan.

The Virginia legislature typically tries to limit its work in midbudget years, and Robb, to help clear the decks for the pressing matter of the deficit, has held down the number of housekeeping bills submitted by his executive departments. For instance, Robb has put on hold for another year a controversial ABC proposal allowing privately owned stores in remote, rural areas to sell hard liquor on consignment from the state.

For the second time, Robb and fellow Democrat Attorney General Gerald Baliles have proposed a package of anticrime bills, including one to expand wiretapping authority and another to allow certain illegally obtained evidence to be used in trials. Parts of the package are expected to run into opposition from influential lawyers in the General Assembly, including House Speaker A. L. Philpott (D-Bassett).

Robb is not the only one with crime on his mind in this election year. Sen. L. Douglas Wilder (D-Richmond) has a proposal for a minimum mandatory sentence for forcible rape, while Sen. Clive DuVal (D-Fairfax) is proposing legislation to allow criminals to be found "guilty but mentally ill" instead of innocent by reason of insanity, which would force felons to serve out their full terms even if they are pronounced "cured" halfway through.

The movement against drunk driving that has mushroomed in recent years will push the General Assembly to raise the legal drinking age to 21, as Maryland did last year, from the current 18 years for drinking beer in restaurants. Some legislators predict a compromise that would raise the age by increments over the next three years.

The political makeup of the General Assembly has changed only slightly since last year, despite special House elections held last fall. Republicans, who had hoped for bigger gains in newly drawn single-member districts, have picked up only one seat in the House so far, increasing their numbers to 34 in the 100-seat chamber.

The Senate, an instution slow to change, will witness the arrival of its second black member, former Del. Robert Scott of Newport News. He replaces conservative Republican Herbert Bateman, elected to Congress last fall. And the Senate Finance Committee intends for the first time to enact a budget bill of its own, setting the stage for a confusing and possibly bitter competition with the House Appropriations Committee, which has traditionally taken charge of the budget.

Any clash between the two committees will be drowned out by the more intense debate over who should bear the pain of budget cuts.