Gerald L. Baliles, the Democratic candidate for governor of Virginia, today urged closing the 200-year-old state penitentiary here, but advocated major additions to other prisons to hold the state's growing inmate population.

In his strongest statements on the prison problems that have dogged the administration of Democratic Gov. Charles S. Robb, Baliles sought to distance his plans from the actions of the current administration.

He said he would lay the groundwork for closing the penitentiary, which holds about 900 inmates,in the next four years and would relocate the prisoners at other facilities. Officials long have discussed closing the aging prison near downtown Richmond, but the Robb administration has resisted the proposal, advocated by several local legislators.

Baliles' Republican opponent, Wyatt B. Durrette, repeated, in a separate speech to members of the Virginia Correctional Association, his charge that the Robb administration has failed to respond adequately to the crowding problems. Durrette said he believes the state may need to build new prisons to accommodate the burgeoning inmate population. He also has recommended expanding existing prisons.

The debate over the state's troubled corrections system, which has been plagued by escapes, riots, management problems and overcrowding, has been one of the most controversial issues in the 1985 governor's campaign.

Durrette today hammered at what he called Baliles' failure, as state attorney general during the past 3 1/2 years, to "provide leadership" during the recent upheavals in the state's prison system.

"Incident after incident rocked the prison system while he was the state's chief law enforcement officer, and the response from him was silence," charged Durrette, a Richmond attorney and former Fairfax County legislator.

Baliles defended his actions as attorney general and said that as governor: "I won't be just a lawyer, I'll be the chief executive -- I'll see that the prisons system will be run the way I want it to be."

While Durrette stressed that his administration's top priority would be improving prison security, Baliles said, "Security worries have taken a back seat to concerns over the capacity of our correctional system."

Baliles said he would recommend expanding the state's prison system by about 1,650 beds during the next four years, but he declined to provide a price tag for his recommendations, which included building two new maximum security blocks at two prisons that he would not identify and constructing a 400-bed facility on the site of the former Deep Meadow Correctional Center in Central Virginia.