A bill that would force public schools in Northern Virginia and elsewhere to close on election day in November was narrowly approved by the Virginia Senate today, even though opponents of the measure said its main purpose was to give teachers time off to be campaign workers.

"This is a political bill, pure and simple," complained Senate Majority Leader Hunter B. Andrews (D-Hampton), who warned that school districts in the more heavily populated areas of the state could lose money if students stretch the holiday into a four-day weekend.

The legislation, passed by a vote of 19 to 17, was supported by the region's eight senators with the exception of Sen. Wiley F. Mitchell (R-Alexandria). All of the lawmakers from Fairfax County, where teacher groups have worked for and contributed heavily to Democratic candidates, voted for the bill.

Proponents of the bill, which applies to cities of more than 20,000 residents and counties of more than 65,000, argued that the legislation was intended as a traffic safety measure to protect students attending schools that double as polling places on election day.

Andrews said the only people in danger of being "run over" by voting traffic would be the candidates, "and we take that risk."

With the schools shut down on the traditional Tuesday in November, Andrews said, fewer students would show up for classes on Monday, thus jeopardizing financial aid to schools based on attendance.

Mitchell said the bill would force Alexandria schools to close on election day "even though there is not one voting machine located" in the public school system there.

Sen. Richard L. Saslaw (D-Fairfax), whose wife is a guidance counselor in Fairfax county and who has received strong teacher support in the past, was one of the bill's cosponsors. He said he saw no conflict in his voting on the bill since he would not gain financially and since "my wife always takes a leave of absence on election day anyway."

Sen. John H. Chichester (R-Fredericksburg), who last week invoked the Senate's conflict-of-interest rule to help kill the Equal Rights Amendment was another husband of a teacher who voted on the school closing measure -- but he voted against it.

Today's floor session, the last day the Senate could take action on bills sponsored by its members, was a grueling one. The senators approved dozens of measures, including a bill that would broaden the state's death penalty law to include mass murders.

That legislation passed the Senate aby a vote of 32 to 7 after Saslaw, its sponsor, said the assembly needed "to close a glaring loophole" in the existing law.He cited, as examples, the killing of nine nurses in Chicago by Richard Speck and the 1976 murder of four people at a Roy Rogers restaurant in Fairfax County.

Both the school closings and the death penalty bill are expected to encounter tough opposition in the House of Delegates.

Saslaw had less success getting the Senate to approve his bill to repeal the controversial "early parole" prison law enacted by the assembly last year.

The measure first cleared the Senate by a vote of 22 to 18, but was reconsidered minutes later and died by a vote of 19 to 21.

Describing the inmate released from prison last summer who then "blew away" two elderly women in Caroline County, Saslaw said the law releasing prisoners six months prior to the expiration of their sentences was a mistake. It was "one of the most blatant examples of do-gooders legislation," said Saslaw, who sponsored the repeal bill at the request of Fairfax County chief prosecutor Robert F. Horan.

Sen. Joseph V. Gartlan Jr. (D-Fairfax) said the repeal movement was "political posturing" by those who would rather put inmates out on the streets "cold turkey" than release them into supervised custody, as the early parole law provides.

Cartlan said deficiencies in computing an inmates's time off for good behavior had contributed to the Caroline County incident. That situation has been corrected by the Department of Corrections.

In other action the Senate, by a 31-to-9 vote, passed a bill designed to reform the states sexual assault laws. The measure eliminates the requirement that there be physical resistance by the rape victim.

Instead, if force or intimidation could be shown, it would be recognized that resistance could not reasonably have been expected. In addition the bill sharply limits evidence that can be introduced about the victim's past sexual conduct.

The effective date of the legislation was postponed to July 1, 1981.