At a time when the city finds itself the reluctant owner of a gorwing number of outdated and empty old school buildings, it also finds a growing shortage of housing for the elderly and low-and moderate-income families.

Some of the city's housing officials think they have a solution to both problems: convert the abandoned schools into apartments.

"In light of the fact that there is a growing shortage of residential houses, these buildings would lend themselves to what they have done at Central Grammar in Gloucester (Mass.)," said Carroll Swanson, head if the neighborhood preservation administration of the city's housing department.

Gloucester pioneered in the reuse of old shcools for housing a few yeara ago when a community group renovated the city's first brick high school, which was built in 1888, into 80 large, distinctive and subsidized apartments for the elderly.

Samson joined James G. Banks, of the Washington Metropolitan Board of Realtors, two private architects and a private builder for a two-day trip to Gloucester last week to look at the new apartments as a preliminary step to realizing the same reuse in the District.

Currently the District school board has given back to the city government six turn-of-the-century elementary school buildings that could potentially be used as new housing, according to school officials. The schools are Dent on Capitol Hill, Blair and Crummell in Northeast and Eckington, Gage and Morse in Northwest.

Also, Shaw Junior High School will probably be added to the list after June. The new multimillion-dollar Shaw school is scheduled to open in September, leaving the large old school, built in 1902 at the corner of 7th Street and Rhode Island Avenue NW, empty and city officials with the problem of what to do with it.

Last week the five District men toured the five-story red brick converted Gloucester school building with Kirk Noyes, the 31-year-old architect from St. Louis who spearheaded the conversion project.

The former school is located in the very heart of the small coastal fishing community of 30,000 residents about 35 miles north of Boston. Noyes is now acting as a consultant to a Lynchburg, Va., community group that is leading the conversion of two schools there to housing.

The Gloucester school, with its 35 classrooms plus auditorium, cafeteria, attic and basement, is an attractive 80-unit apartment house with carpeted hallways and apartments, large bright yellow doors for each unit, and wide corridors for wheel-chairs. The apartments on the top floor of the building have small balconies that were created by cutting out sections of the roof.

Several of the residents in the building graduated from the high school more than 50 years ago. One of these is Gertrude Colby, a 1921 graduate. Now she lives in a one-bedroom apartment that was formerly the location of her homeroom and its cloakroom.

"We used to come right in that door," Colby said, pointing to the picture window that dominates her living room. In the renovation the entrance to the building was changed and her half-moon window was built into the archway where the school doors once stood.

"We would walk right up here (through her present dining room and kitchen) to our classes," she said, still obviously a bit awed by the changes in the building although she has been a tenant since the apartments opened in 1975.

One of the major reasons Colby said she likes the apartment house is its central location in her native Gloucester.

"I've enjoyed every minute here," she said. "I don't get out much because of my arthritis. I can sit here and see so much going on. I can see the city hall and the library and the Post office (which are across the street.) It is so central to everything," she said, looking gratefully a large window lavishly decorated with flowering plants.

Elinor Martin, 68, graduated from the high school four years after Colby and her one-bedroom apartment was formerly the room where she learned to sew.

Her living room is highlighted by a wall of oak panelling under the window, which is the original panelling used in the school.

Since the classrooms were so large, Noyes said, many of the rooms were used intact to form the 73 one-bedroom apartments in the building. There are also two-bedroom apartments.

Noyes said he became interested in converting the building while working for a Gloucester community organization in 1970. "We were faced with the problem of how to introduce new housing in a city tha is compact and doesn't have land for new housing. The empty school looked like a natural," he said.

The price tag for the renovation was almost $1.5 million and the Massachusetts Housing Finance Agency financed the construction, Noyes said.

The renovation was much cheaper than construction of a new building, he said. It cost about $18,500 per unit in the renovated school while it would have been about $26,000 per unit to build the same size building, he said, and the new building and apartments would have lacked distinctiveness.

"There was a lot of selling to convince people, especially the City Council and the city manager, that it would work," Noyes said. The city manager wanted the school demolished to make way for a parking lot for city hall, and the city's fire chief thought the building unsafe.

After allowing Noyes and his group to keep an option on the school for three years at the cost of $1 per year, while financing was arranged and plans drawn, the city finally sold the building to the group for $96,000. Eighteen months later construction was completed, Noyes said.

Lorenzo Jacobs, director of the city's housing department, said the city is about "to study the feasibility of the Gloucester project and if it is feasible for the District then the department will handle each school on a case-by-case basis."

Some of the buildings, particularly those located in residential areas, might prove suitable for housing while others might be better used for commercial, office or community use, Jacobs said. It will be about three months before the study begins.

Architect Paul Devrouax made the trip to Gloucester with one of his associates because they have been trying for two months to obtain city approval for such a study, one which they would like to conduct, he said. Devrouax said his firm has been interested in school conversions because of work they have done on reuse proposals of other buildings for several federal agencies.

James Banks said he organized the trip because he believes the D.C. Housing Industries Corp., a nonprofit organization composed of some of the city's leading lending institutions and builders, could act as the developer for such conversions.

The group has already rehabilitated 35 homes in the Shaw community for low-and moderate-income families and soon will begin the renovation of 54 houses in the same community. The homes were formerly owned by the city and sold to the nonprofit group.

The city is gaining an increasing number of old school buildings that are in good condition because the number of elementary age children has declined in recent years and new schools have been built to replace the old ones.