A 22-year-old Northern Virginia man was convicted by a Fairfax County jury yesterday of attempting to rape his estranged wife. It was believed by court officials to be the first time that a husband has been successfully prosecuted in the state under rape laws for an offense against his spouse.

The verdict against a carpenter's assistant came from a six-man, six-woman Circuit Court jury that rejected a prosecutor's appeal for a conviction on a more serious charge of rape. The jury recommended that the husband be given a two-year prison sentence.

Both sides in the case claimed victory. The convicted man left the courtroom laughing and joking, saying he viewed the verdict as a major victory over the more severe rape conviction the jury could have rendered. "Let's go out and celebrate," one of those who gathered around him was heard to exclaim.

The prosecution said that although the verdict was not the one it sought it would nonetheless set a major precedent in Virginia.

"I believe the natural inclination of the jury would be not to convict the husband," said Assistant Commonwealth's Attorney Thomas E. Gallahue, who prosecuted the case. "The jury was very fair . . . ."

It was a case Gallahue described in closing arguments as "a sad commentary on these human beings' lives that they come before a jury with a case of love gone bad."

The couple had been separated 11 months at the time of the offense, a fact that Judge Richard J. Jamborsky had ruled Wednesday was crucial to the case. He held then that a husband can be accused of rape in Virginia only in cases in which the couple have been living apart.

Although prosecutors said the real test of the case may come in appeals to the Virginia Supreme Court, defense attorney Myron Teluck said his client had not yet decided whether to appeal. If the husband is sentenced at a Jan. 21 hearing to the full two years recommended by the jury, he would be eligible for parole in four months and 26 days.

The jurors, who debated 3 hours and 15 minutes, delivered what some observers considered a compromise among the verdicts Jamborsky told them they could render. He offered them four possible verdicts: rape, which carries a penalty of five years to life in prison; attempted rape, which carries a 2-to-10-year prison term; assault and battery, which carries a maximum penalty of one year in jail and/or a $1,000 fine; and not guilty.

The man's estranged wife, seated in the back row of the courtroom, listened expressionless as the judge read the verdict. She left the courtroom without comment.

During closing arguments, Gallahue described the husband as an insanely jealous man driven to rape his wife in an effort to determine if she "had been fooling around with other men" after the two separated Nov. 9, 1981.

Defense attorneys portrayed the 20-year-old wife as motivated to fabricate rape charges because of disputes with her husband over custody of their daughter, aged 2, and her alleged embarrassment at friends discovering she had sexual relations with her husband after their separation.

Prosecutors charged the husband tracked his wife and a date to a friend's sixth-floor apartment in Annandale the night of Oct 17. According to the prosecution, the man scaled six floors of balconies "like Spiderman" and banged on the balcony door of the apartment where his wife was until she let him in. The wife testified her husband scuffled with her date and then locked him out of the apartment.

She said he then dragged her into a bedroom, pulled off her clothes and raped her while friends outside heard her screams and banged on the locked door.

The husband testified that his wife willingly engaged in foreplay and began screaming "rape" only after he denied he had been sleeping with another woman.

Gallahue said he partly attributed the conviction to witnesses who testified yesterday that the husband had lied about nude photographs he had taken of his wife, raising questions about the credibility of the husband's previous statements.

During the first day of testimony in the case, defense attorneys produced five photographs of the wife in various poses. The husband said they were taken this past summer, months after the two separated, and were proof that his wife had had sex with him since their separation.

But witnesses who included the clerk at the photo shop where the pictures were developed, testified the photographs were developed in the summer of 1981, when the couple was still living together.