Virginia state Sen. John S. Joannou and former state senator Willard J. Moody were indicted yesterday on federal charges of mail fraud and conspiracy in what prosecutors said was a six-year scheme to help their law clients and others avoid being convicted on speeding charges.

The indictments were believed to be the first in recent years by a federal grand jury of a sitting member of the Virginia General Assembly. Moody, 60, who up until this year was a member of the Senate's Democratic leadership and chaired the Senate Rules Committee, was also indicted on three counts of perjury before a Norfolk grand jury that has been probing allegations of corruption in his hometown of Portsmouth.

Neither Moody nor Joannou, 44, a Democrat who succeeded him in the Senate, could be reached for comment yesterday. Both have previously said they are innocent of any wrongdoing. The two, both lawyers, are to be arraigned in Norfolk Oct. 31.

The 20-count indictment filed in U.S. District Court in Norfolk grows out of a year-long investigation by the FBI that has already led to the conviction of Portsmouth's police chief and his wife on charges of lying to the same federal grand jury about whether they paid for an automobile they had obtained from a dealership that was owned in part by Moody.

Legislative leaders, staff members and political historians in Richmond said yesterday they could not recall any federal indictments of former or sitting members of the state legislature. Virginia legislators frequently tout their reputation for honesty, often saying it is in sharp comparison to that of the Maryland legislature, a number of whose members have been indicted by federal prosecutors.

Virginia, unlike Maryland, does not automatically require a legislator who has been convicted to leave the General Assembly. Senate Majority Leader Hunter B. Andrews of Hampton said yesterday any conviction of a senator would be referred to an outside ethics panel, which then would recommend action to the Senate Rules Committee.

Senate Minority Leader William A. Truban, a Republican from Shenandoah County, hinted that Joannou, a member of the General Assembly since 1976, should step down. Truban said he was not familiar with the case, but said: "It will be very difficult for a man to serve if he is under heavy strains from a court case. It's sad, I really hate to hear that of a public official in Virginia."

The indictment outlines a scheme in which Moody and Joannou allegedly secured statements from Moody's automobile dealership, falsely stating that the speedometers on cars of persons arrested for speeding were faulty. These statements then were used in Virginia courts by their clients and others to win acquittals, according to the prosecutors.

Virginia law permits the use of speedometer calibration certificates as a defense in speeding cases to show that a car's speedometer has been checked and is inaccurate.

The prosecutors allege that the two lawyers mailed information about speeding violations to Clarence G. Mixon, who was Moody's partner in Sun Motors Cars Inc., a defunct Portsmouth automobile dealership.

Mixon, named as an unindicted coconspirator, allegedly helped the company produce inaccurate and false calibration certificates. The test results also fraudulently stated that repair work or adjustments had been made to correct the speedometers, prosecutors said.

The indictment alleges that Sun Motors did not have a dynamometer, the machine used to test speedometers, until Dec. 24, l981, six years after the conspiracy by Moody, Joannou and Mixon allegedly began.

Mixon pleaded guilty in September 1983 in federal court in Norfolk to two counts of defrauding General Motors Acceptance Corp. of money it was owed for the sale of Sun Motor vehicles. He has cooperated with the investigation and Moody has attacked his credibility in press conferences. Peter G. Decker Jr., a Norfolk lawyer who represents Joannou, told the Associated Press "Sen. Joannou is innocent of all charges against him."

If convicted, Moody faces a maximum of 100 years in prison and a fine of $60,000. Joannou faces a maximum sentence of 80 years and a fine of $25,000.