A federal judge in Richmond struck down yesterday two Virginia laws that make it illegal for unmarried couples to engage in sex or to live together, saying the statutes violate an individual's right to privacy.

District Judge Robert R. Merhige Jr., in a ruling hailed by civil liberties lawyers, said "an attempt to regulate public morals cannot extend into the privacy of one's home."

Privacy-rights proponents characterized the decision as part of a recent trend toward limiting the right of government to regulate individual morals. While the two Virginia statutes involved in yesterday's ruling are rarely enforced, Michael Morchower, an attorney for two unmarried Richmond residents who challenged the laws, said, "They can be used as a weapon by police."

Merhige's ruling came in a lawsuit filed last year against Richmond's police chief and prosecutor by a man and a woman in their 20s, identified only as James Doe and Jane Doe. Neither has been charged with violating the two Virginia laws, which ban fornication and cohabitation by unwed couples.

But both the man and woman said in affidavits that the fear of prosecution had led them to abstain from sex and intruded on the right "to happiness as a single person."

It was unclear yesterday whether the decision would be appealed. A spokesman for State Attorney General Gerald L. Baliles, whose office argued that the laws were needed to promote "traditional, marital and family relationships," said no decision had been made whether to appeal. Assistant Richmond City Attorney Michael L. Sarahan said an appeal would be filed with the 4th Circuit Court of Appeals.

Lawyers for the public officials named in the suit argued in court that the laws not only encouraged "traditional moral values" but also limited sexual disease and minimized illegitimate births, according to Merhige's 17-page opinion. They also contended that since 1978 the Richmond police have enforced the laws only against individuals who engage in sexual acts in public.

Merhige said the purpose of the statutes clearly was to prevent "sexual intercourse among unmarried individuals" and noted that Richmond police have arrested at least eight persons on fornication charges since 1982.

The judge cited previous Supreme Court decisions that affirmed the right of married and single women to bear children and he said that right necessarily includes the right to have sex.

Merhige directed the Richmond officials not to enforce the two laws, saying they were too broadly drawn. "Unquestionably, the state has the power to prevent open and gross, lewd and lascivious conduct" in public, he said.

Though Merhige's ruling applies only to laws affecting heterosexual behavior, Burt Newborne, national legal director of the American Civil Liberties Union, said "it sets up an argument" against use of Virginia's sodomy statute against homosexuals. "If two unmarried people can live together if they are of different sexes," Newborne said, "why shouldn't the same rule apply to two people of the same sex?"

Merhige, who has a reputation as a liberal judge, noted in his opinion that he dissented from a ruling in a 1975 case that declared Virginia's sodomy statute constitutional on the basis that the right of privacy does not extend to homosexual conduct.

Morchower said the state's statutes on fornication and cohabitation have been on the books since at least the early 1900s. He said such laws are still common in many states, though Newborne said they are gradually being struck down.

Both acts are misdemeanors in Virginia. The maximum penalty for unmarried adults who live together "lewdly and lasciviously" is set at $500, though a second offense is punishable by a fine of $1,000 and a year in jail. The maximum penalty for an unwed person who engages in intercourse is $100.

Morchower said he became concerned about the laws in the mid-1970s, when he represented several drug suspects in Richmond. He said police had arrested the individuals on charges of cohabitation because they were unable to find enough evidence for drug charges.

The lawyer said he decided to challenge the statutes because "they're antiquated and discriminatory and can be enforced. I just got tired of the threat . . . especially with the country moving in the direction it is."

Merhige said in his opinion that while police gave allegations of the misdemeanors low priority, "the statutes are enforced if complaints are received and the police at the time have available manpower to respond."