Less than 24 hours after Virginia Atorney General Anthony F. Troy accused the state's news media of deliberately flouting a controversial law prohibiting disclosure of investigations of state judges, two Richmond newspapers were charged yesterday with violating the statute.

In papers filed in Richmond Circuit Court, both of the city's daily newspapers. The Times-Dispatch and News Leader, were charged with committing a misdemeanor by publishing stories about two Richmond-area judges that are said to be under scrutiny by a state judicial commission.

The charges were the third to be filed in the state against a newspaper under a 1971 statute that requires proceedings before the state's Judicial Inquiry and Review Commission to be secret. Early last month the State Supreme Court ruled 6 to 1 that the law prohibits newspapers from publishings stories naming the judges being investigated by the commission.

Claiming that the ruling violates the First Amendment's guarantee of a free press, officials of the first newspaper convicted under the law. The Virginian-Pilot in Norfolk, have said they will appeal the case of the U.S. Supreme Court.

Richmond Commonwealth's Attorney Aubrey M. Davis filed the latest charges only a day after Troy, in a bitter speech to the Richmond Public Relations Association, attacked the Richmond newspapers. He said their stories on the two Richmond judges "on their face appear to be in direct conflict and direct violation of the laws of this commonwealth."

Although Davis could not be reached for comment yesterday a spokesman for Troy said his speech was not a call for legal action against the newspapers. "He was not attempting to prompt anything," said August Wallmeyer, Troy's spokesman.

Earlier this month in a hearing before U.S. District Judge Robert R. Merhige, a lawyer from Troy's office and one representing Davis, sought to assure Merhige that the state had no plans to charge a Richmond television station that wanted to broadcast a news account about one of the judical investigations. Merhige then granted the station a 10-day period in which it could - and did - broadcast the information without fear of being indicted.

The order has since expired and Murray J. Janus, who represented David, said yesterday his statement that no additional charges were being planned dealt only with the possibility of charges being considered "at that time" against station WXEX-TV, which sought Merhige's order.

Officials of the Richmond newspapers, whoch traditionally have been aligned editorially with the state government, declined comment on the charges. However, the newspapers' lawyer, A. G. Brent, said Davis had not warned the newspapers in advance of the charges.

Neither judge mentioned by the Richmond newspapers is named in the charges Davis filed with the court. The charges said only that the News Leader on March 28 and The Times-Dispatch on Jan. 29 "did unlawfully divulge publicity" the nature of a commission proceeding.

On Jan. 29, the Times-Dispatch published a story saying the commission was investigating Richmond General District Court Judge Harold C. Maurice, who has since resigned from the bench. On March 28, the News Leader published a story saying the commission was holding secret hearings on complaints against Henrico County General District Court Judge H. Radcliffe Turner.

Troy, in his speech, was especially critical of the Richmond newspapers because he said they "have time and again been involved in (editorial) campaigns advocating that minorities should work within the law and castigating these minorities for demonstrations which were outside the gambit of either the legislative process or the constitutional challenges available within the judiciary."

"But the newspapers and broadcasters continue to write about judges under investigation," he said. "They continue to flaunt the law rather than working within the system as it exists."

". . . It is, in short, intellectual dishonesty for the media to tell one class of people that change can only come about through the legislative or judicial process and then, on the other hand, ignore the system and continue to violate the law," he said.