District of Columbia personnel officials are considering requiring the city's 20,000 employes who live in Maryland and Virginia to move into the city if they want career promotions.

The possibility was disclosed yesterday by Wilmer Gilmore, deputy director of the D.C. Office of Personnel, who said it is still in the discussion stage. Such a requirement would require D.C. City Council action.

Under a new personnel law enacted by the council last year, municipal employes hired after next Jan. 1 must, with few exceptions, be city residents. Mayor Marion Barry said yesterday he will strictly enforce that provision.

The possible extension of the residency requirement to cover any current employes was immediately protested by a leader of the city's largest union of municipal workers.

"We would be adamantly opposed to that," said Geraldine Boykin, executive director of Council 20 of the American Federation of State, County and Municipal Employees, which claims to represent 16,000 of the city's more than 40,000 workers.

Boykin told a reporter the city lacks adequate housing for city workers in the middle-income group that makes up most of her union's membership.

At a briefing for 200 workers on the city's new personnel system, Gilmore took note of the residency requirement for new workers and of the fact that the law permits employes who now live in the suburbs to remain there without penalty.

"There may be some modification of that rule," Gilmore declared.

After the briefing, Gilmore said officials in the personnel office have discussed the idea of requiring employes living in the suburbs who want promotions to higher-ranking or better-paying jobs to more into the city. Normal pay increases resulting from length of service would be exempted, he said.

"I don't see that law being changed this year, but we are looking into the future a year or two," Gilmore told a reporter. "It's just been an informal discussion."

Gilmore's boss, Jose Gutierrez, the city's acting personnel director, played down Gilmore's statement, insisting: "It's a staff thing . . . I'm asking staff people to think of all options, regardless of how far-fetched they are. We are just exploring options."

Gutierrez opened the briefing, but left before Gilmore spoke.

The residency requirement for new employes in the current law was a compromise.

As originally proposed -- and supported by Barry, who was then a member of the City Council -- the measure would have required all municipal employes, old and new, to live in the city. As finally enacted, all now living in the suburbs are allowed to stay, except those chosen as department heads.

Virtually the only newly hired employes permitted to live in the suburbs will be those with jobs at such city-owned institutions as the Lorton correctional facility in Virginia or the Glenn Dale Hospital in Maryland.

About half the current city employes live outside the District, but the number varies widely among departments. The most recent available figures show that more than half the teachers live inside the city, but 25 percent or less of the police and firefighters.

Speaking briefly at the outset of yesterday's meeting, Barry endorsed the residency requirement for new employes. The mayor said: "That's the law. I intend to enforce it. I believe in it."

Barry, who has said he is unable to buy suitable housing in the $100,000 price bracket, took note of the impact of the housing shortage on lower-paid workers.

"I have a responsibility to improve the housing situation in this city," he said. "Housing is critical . . . "

Anita Shelton, director of the city's Office of Human Rights, also spoke at the briefing. She said her office will set "definite goals about the [upward] movement women in the D.C. government." These goals, she expects, will be met under the new personnel law. She, like several other speakers, said women, especially black women, are too heavily concentrated in the lowest-paid jobs.

The new personnel law, authorized by the 1975 Home Rule Charter, is intended to separate the city's personnel administration from that of the federal government. One provision calls for the negotiation of wage scales by unions starting next year.