A federal magistrate in Richmond dismissed a lawsuit yesterday that was filed five years ago over alleged safety and security problems at the Virginia State Penitentiary.

The dismissal by U.S. Magistrate David G. Lowe in effect cleared an agreement reached nearly two months ago by lawyers for the Virginia Department of Corrections and the American Civil Liberties Union on how to limit access by inmates to metal objects and tools at the Richmond prison.

However, Lowe gave inmates time to study the accord and file any objections to it. No prisoners have expressed any disagreement with the settlement.

The suit was filed in 1982 by the ACLU's National Prison Project. The ACLU alleged that conditions of confinement at the prison were so bad that inmates' constitutional rights were violated.

Lowe heard the case without a jury during a 10-day trial in 1983. He found then that conditions at the prison, while hardly ideal, did not subject inmates to cruel and unusual punishment.

Lowe's ruling was upheld by the 4th U.S. Circuit Court of Appeals except for one aspect. The appeals court asked the magistrate to review again the inmates' access to scrap metal.

In the settlement, the state set forth ways it would limit access to scrap metal and tools used at the prison. Included is a system of inventory methods to see who is using what tool, when and for what purpose.