It will either be the opening scene or the closing act for dozens of candidates in Northern Virginia Tuesday when voters are scheduled to go to the polls to select their party's nominees for various state legislative and local offices.

Candidates, now in the closing days of their primary races, have been handing out leaflets, speaking, shaking hands and pouring over voter registration lists, hoping to draw enough votes to win the right to carry their party's banner into the fall elections.

Issues range from crime to drugs to utility costs to abortions, but the major theme this year appears to be transportation. And on that there appears to be little disagreement among the candidates: Northern Virginia's traffic congestion is intolerable and the region should get more money from the state to improve its roads.

Besides congestion in the streets, there also is a fair amount of crowding in some of the races, most notably, the fight for the 42nd District House seat in southern Fairfax County, being vacated by Republican Warren E. Barry. A member of the House since 1970, he is running for the clerk of Fairfax County Circuit Court. Four Republicans are vying for the chance to face off against one of the three Democrats fighting for their party's nomination.

Lining up on the GOP side are real estate agency executives William P. Whalen and Bruce L. Green, teacher J.J. (Jack) Caussin and retired Army officer Robert K. (Bob) Cunningham. On the Democratic side are attorney Lawrence Pascal, management consultant Lester A. (Les) Fettig and special education coordinator Mark L. Glaser.

Another retirement, that of Democrat Sen. Adelard L. (Abe) Brault, dean of the Northern Virginia delegation in Richmond, has brought five candidates into the struggle for his 34th District seat. Democrats must choose between former Brault aide Emilie F. Miller and lawyer Daniel S. Alcorn, while Republicans must pick Fairfax City Mayor John W. Russell, businessman Robert E. (Bob) Murphy or consultant E. Joseph (Joe) West.

In Loudoun and Prince William counties, it is the sheriff races that have attracted the most attention.

The retirement of Prince William County Sheriff Carl A. Rollins Jr. caused five candidates to toss their hats into the ring. Democrats are police detective Wilson Carlin Garrison Jr., police investigator David C. Mabie and sheriff's deputy Bernard E. (Bernie) Wilkinson. Republicans are police sergeant Harry M. Hittle and professional auctioneer Frank E. Bolton.

Loudoun County Sheriff Donald L. Lacy, a Republican, announced he would retire after he was put on probation by a Virginia judge last summer for misconduct.

Three Democrats are running for their party's nomination to the post. They are Fairfax County police captain John R. Isom, former state trooper J. Roger Etienne and businessman James F. Boyd.

In Fairfax County's 38th House District, Gwendalyn F. (Gwen) Cody is hoping to beat real estate agent Lynne E. Purvis for a chance at a fall rematch with Democrat Del. Nora Squyres, who ousted Cody in a close race last fall. She had served one term in the House of Delegates.

Reston attorney Daniel K. Moller and Lonnie B. Bridges of Hamilton, director of buildings and energy for the Loudoun school system, are seeking the Republican nomination for the 33rd Senate seat of western Fairfax and Loudoun counties, held by Democrat Charles L. Waddell.

There are primaries for two seats on the Fairfax County Board of Supervisors. In the Springfield District, educator Elaine N. McConnell is challenging incumbent Marie B. Travesky for the Republican nomination, while in the Democratic camp, pharmacist G.T. (Gerry) Serody and guidance counselor Thomas E. Giska are fighting it out.

In the Providence District, two Republicans lawyers, Stephen A. Armstrong and John D. Austin Jr., are fighting to capture their party's spot to oppose incumbent Democrat James M. Scott in the general election. Independent William Lockwood, former chairman of the Fairfax County Planning Commission, will make the fall election a three-way race.