The American Civil Liberties Union, charging Virginia has one of the worst prison medical care records in the nation, sued state corrections officials for $2 million today on behalf of a mentally ill inmate who castrated himself in an isolated cell at the state penitentiary here.

The prisoner, a 30-year-old Fairfax County man convicted of rape, castrated himself with a disposable razor just two days after his sister, a psychiatric nurse, warned prison officials that her brother was on the verge of a nervous breakdown, according to the suit.

The suit, filed in U.S. District Court here, also alleged the prisoner was furnished the razor and confined to isolation despite a six-year history of mental illness and three previous attempts at self-mutilation.

The castration episode occurred on Feb. 24, 1979, one month after the state had agreed to pay $518,000 to another state penitiary inmate who lost the use of his legs. The inmate suffered from maggot-infested bed-sores developed while receiving massive and apparently unmonitored doses of tranquilizing drugs at the prison infirmary.

"We're making Virginia a national example," said Alvin Bronstein, director of the ACLU's National Prison Project. He charged state officials "are unwilling to operate the prison system at even a minimal level of humanity or a minimum level of constitutionality."

ACLU officials also cited statistics showing prisoners have filed more federal suits in Virginia during each of the last two years than in any other state. They said more than 25 percent of the suits concerned lack of proper medical treatment.

"We're just touching the tip of the iceberg," said ACLU attorney Stephen Bricker.

State prison officials and the Virginia attorney general's office refused to comment today on the suit or on the ACLU's charges. Officials have previously contended that they have improved medical care by hiring a new director of prison health services and ordering a "reassessment" of facilities, moves which the ACLU and other critics contend are cosmetic.

The State Penitentiary's medical unit is not required to be certified or inspected by either the state health department or a national hospital accreditation group despite the fact surgical procedures are regularly performed there on inmates. The General Assembly passed a bill last year requiring the health department to inspect prison facilities, but it was vetoed by Gov. John N. Dalton.

Penitentiary sources say occasional self-mutilations by inmates seeking transfer to one of the state's mental institutions occur at the prison but none could recall a previous episode of castration.

The suit filed today did not name the castrated inmate, who has been confined to Central State Hospital in Petersburg since the incident.

The suit alleged the inmate, whom it called "Jack Moe," had an extensive history of pyschiatric illness dating back to 1973. In February 1978 he was sentenced by a Fairfax County Circuit Court judge to a 40-year term for rape and placed in the Powhatan Correctional Center west of Richmond.

According to the suit, Moe was transferred to Central State for psychiatric care twice in 1978 and returned after treatment each time to the Powhatan prison.

The suit contends Moe was denied a request to return to Central State again in November 1978 and was transferred instead to the state penitentiary in Richmond. The request was denied despite three episodes in six months during which Moe banged his head against walls, pulled out stitches from his head and pulled out his fingernails, according to Thomas Barney, his Richmond lawyer.

Penitentiary officials did not obtain adequate medical information in Moe from Central State, according to the suit, and were thus unaware of his past medical history. He was confined to an isolation cell where the suit alleges he did not receive adequate care or supervision. It also alleges that penitentiary officials did not give Moe antipsychotic medication despite being told by Central State personnel that the medicine was necessary.

On Feb. 22, 1979, the suit says, Moe was visited by his sister, a Richmond psychiatric nurse, who warned officials of his deteriorating mental condition. Two days later, he hacked off his genitials with the razor and also suffered a large gash on his head from banging it on the floor.

ACLU officials said they intend to continue filing suits such as Moe's until Virginia prison officials begin to make improvements. They said other states had reacted to last year's $518,000 settlement by improving conditions but that Virginia had not.

"If they have to pay out enough money, maybe eventually they'll clean things up," said Virginia ACLU director Chan Kendrick.