A group of Northwest Washington residents has prevented a developer from erecting a 39-unit apartment building at Connecticut Avenue and Military Road NW, convincing a judge that a 1910 covenant prohibiting construction of an apartment building on the site takes precedence over the developer's D.C. building permit.

Gilbert Oken bought the quarter-acre lot at the southwest corner of the intersection for $500,000, secured a city permit to construct a four-story building that complied with the parcel's apartment-house zoning and earlier this year razed the brick home on the lot in preparation for construction work. Oken had constructed another apartment building across Connecticut Avenue on land with a similar covenant prohibiting construction of an apartment building, but no one challenged that project.

The developer, however, had not counted on the tenacity of the 283 residents of the Chevy Chase Heights subdivision, who first protested to city officials that the building permit should not be issued and, when that failed, successfully sued Oken to block the construction.

The homeowners' attorney, Steven A. Skalet, said the decision, issued by D.C. Superior Court Judge Robert A. Shuker, "means that for any community that has a covenant, the courts are going to enforce them in spite of the zoning. The moral of the story is that you have to enforce the covenants. The more you permit the covenants to be violated , the worse trouble you're in.

"A couple of violations might not matter," Skalet said. "But the question is, 'Have you changed the character of the neighborhood?' "

In Chevy Chase Heights, Skalet said, "There are no garages, gas stations, convenience stores. Somebody may be violating the covenants, but the neighborhood is pretty much intact."

He said the type of covenant enforced in Chevy Chase Heights was commonly placed on land as Upper Northwest Washington and the nearby Maryland suburbs were developed, as well as elsewhere in the Washington area. Developers now are seeking to develop such tracts along Connecticut Avenue, but he said their projects could be blocked by long-standing covenants if they have been enforced in the past.

Fred Ribe, a congressional staff economist who served as chairman of the Chevy Chase Defense Committee, said the community felt pressured by more intense development from all sides and that the decision "will help us turn back other developers."

Joe Turner, a partly retired free-lance editor who has lived in the neighborhood since 1958, said Shuker's decision "means a continuation of the neighborhood the way it is. We wanted to maintain this as a stable environment."

Oken declined comment on the decision but this week decided to appeal it to the D.C. Court of Appeals.

Many of the homeowners have lived for decades in their 60- and 70-year-old residences that are worth between $200,000 and $400,000. They have raised $20,000 to cover part of the $35,000 legal bill they incurred in fighting Oken's plans.

They also collected pictures of all of the stucco, brick and wood homes in their community to present as evidence that Chevy Chase Heights had remained much as the Chevy Chase Land Co. of Maryland had envisioned when starting to develop it in 1910. One covenant written at the time stated that "no apartment house or apartment houses shall be erected."

Since that time, the land along Connecticut Avenue was zoned by the District government for apartment use, prompting city officials last September to give Oken his building permit.

Oken testified during the court case that "I built across the street with a similar covenant, almost word for word, and I have been advised . . . I figured as long as I built across the street with practically the same covenant that there shouldn't be any problem in building it over here."

But Shuker ruled last month that the 76-year-old covenant "remains in effect."

"Mr. Oken, when he took this property, knew that there was such a covenant. And he has so testified himself. Apparently he hopes, as he has succeeded in the nearby property, he could change the character of the neighborhood without protest," the judge said.

"However, the single-family residents of this neighborhood were determined in keeping the neighborhood as it had been originally intended. . . . They have shown, I think, by convincing and overwhelming evidence that there was a common scheme . . . and that common scheme has remained in effect. They have the right to insist that it remain so," the judge ruled.