The number of Northern Virginia and Prince George's County residents using the Metro subway system has increased markedly in the past two years, according to a survey released yesterday by the transit authority.

Metro officials attributed the increase in Northern Virginia riders largely to the opening last December of the Yellow Line extension to Alexandria and Fairfax County.

Officials said it is unclear why gains had occurred in Prince George's County ridership. But they noted that some Prince George's residents drive across the Woodrow Wilson Bridge to park at the Huntington station in Fairfax.

The survey also showed: A sizable increase in the number of subway riders traveling to or from work. This trend was partly offset by decreases in passengers going to schools, shops, restaurants and recreational or other leisure-time activities. An increase in the number of passengers who say they would have traveled by car if the rail system were not available. Officials said the statistics indicate that Metro has helped ease traffic by taking about 40,000 cars a day off Washington-area roads.

The survey was conducted last May during a period of significant growth in subway patronage. The increases, which began in 1983, followed a decline that had troubled Metro officials in 1982.

Overall Metro bus and subway ridership reached a peak of more than 187 million trips in fiscal year 1980 during a time of nationwide gasoline shortages.

The totals dropped during the next three years but then began rising. Bus and rail patronage totaled 181 million trips in fiscal 1984, which ended June 30, and further increases have been predicted this year.

The May survey showed that the number of Fairfax County subway riders climbed to an average of 36,457 a day, an increase of 7,036trips a day compared with a similar survey two years ago.

The number of rail trips by Alexandria residents rose by 2,560 to 16,626 a day. Trips by Prince George's residents averaged 51,217, an increase of 2,256 a day. Officials said these gains were notable because other counties and cities showed smaller increases or decreases.

The number of subway rides taken by commuters to or from work rose to 195,698 a day, or 63.4 percent of the 308,766 daily trips tabulated in the survey. Trips by commuters increased by 14,130 a day compared with the 1982 survey, when they accounted for 60.9 percent of all subway rides.

Robert A. Pickett, Metro's assistant planning director, said the increase in trips to or from work partly reflected the opening of the Yellow Line extension, which serves many suburban commuters. More commuters also appear to be riding trains at times other than rush hours, he added.

The survey indicated that 105,960 trips a day were taken by passengers who said they would have traveled by car if the rail system were not available, an increase of 14,324 trips a day since 1982.