Virginia state Del. W.R. (Buster) O'Brien, the Republican candidate for attorney general, said today that his Democratic opponent violated state law in the early 1970s by serving as an assistant prosecutor without formally being sworn in.

The charge by O'Brien, who has trailed Democrat Mary Sue Terry of Patrick County in both fund-raising and public opinion polls, came in response to charges today by Terry that O'Brien, "in a shrill, unprincipled attack," has improperly suggested she has lied about her experience.

The exchange before about 500 members of the Richmond Bar Association here was the sharpest yet in a campaign that has been waged largely in the shadow of this year's races for governor and lieutenant governor.

O'Brien, a Virginia Beach legislator, said his campaign has found no record that Terry had been properly sworn in when she began serving as an assistant commonwealth's attorney for Patrick County in 1973. Court records show that a ceremony did take place in December 1975.

O'Brien said state law requires a formal ceremony and said someone acting as a prosecutor without being sworn in would face a fine of $100 to $1,000.

Retired Patrick County Circuit Court Judge John D. Hooker said in a telephone interview later in the day that he did not specifically remember the ceremony from dozens he administered. "The fact that she may have gone on without a formality is to me of no moment."

Hooker called O'Brien's statement "ridiculous . . . . He's trying to exploit and capitalize on something we would consider utterly trivial. What is really material is that Mary Sue Terry acted in the capacity of assistant commonwealth's attorney from the fall of 1973 until the time she gave up that work in the later part of 1977."

According to the Patrick County Circuit Court clerk's office, Terry's first paycheck as a prosecutor was issued in November 1973.

Terry, a legislator from Patrick County who touched off today's clash with her denunciation of O'Brien's campaign, dismissed the allegations, saying it wasn't her job to make sure papers were formally filed.

O'Brien's low-key campaign style has prompted criticism from some Republicans, who said today's was his best appearance.

In a written statement, Terry addressed O'Brien's statements about her rather than the four legal issues the candidates were to discuss. She said O'Brien had repeatedly misstated the number of cases she tried as an assistant prosecutor, had claimed she has never argued a case before the Virginia Supreme Court or prosecuted a capital murder case, "suggested that I had lied about" experience as a prosecutor, and had supported weak drunken driving statutes.

"The most valuable commodity you have apart from your ability is your credibility," Terry said, "and that you never, never make an allegation that you can't back up."

O'Brien, responding without a written text, said he stood by each of his charges, which he said were different from Terry's portrayal.