More than 40 mentally retarded Northern Virginia residents, many of whom have lived in institutions all their lives, will be released from a state training center and resettled in local communities under a plan approved Thursday by Virginia Gov. John N. Dalton.

Under the plan, the mildly retarded adults and children will be moved out of the Northern Virginia Training Center for the Mentally Retarded in Fairfax County. By redirecting existing funds and programs, the state will finance care and training of the mildly retarded in a variety of community-based facilities.

"We hope to have the plan in the initial stages of implementation before the end of this year," said Jean Harris, state secretary of human resources, who directed an interagency task force that produced the plan under guidelines specifying that handicapped persons should be given the least restrictive alternatives.

The training center residents to be released range in age from 10 to 48. The services they will need include shelter, supervision, productive work or other activity, health care and access to recreation and training.

Areas affected by the plan - Arlington, Fairfax, Loudoun and Prince William counties and the cities of Falls Church and Alexandria - will meet the needs of the retarded through existing programs, and where necessary, the development of new ones, officials said.

The plan was praised by local officials concerned with making services for retarded citizens available outside institutions. But some said the threat of a lawsuit was necessary to move state officials to action.

"Where I sit, the real push, the real urgency came when there was a threat of litigation," said Dr. Robert Lorish, director of the Fairfax-Falls Church Services Board's mental retardation services.

The threat of a suit "added impetus," Harris acknowledged, "but we had begun planning long before."