The D.C. Zoning Commission voted yesterday to permit halfway houses and other group homes in all residentially zoned neighborhoods and some other areas of the city, ending their concentration in the densely populated areas north of downtown.

Small group homes for up to eight residents, except those for persons accused or convicted of crimes or those housing narcotics or alcohol abusers, may in the future be located in any area zoned for residential or neighborhood commercial purposes. Generally, there can be only one in each city block.

Larger homes, and all homes of any size for persons in the corrections and alcohol- and narcotics-abuser categories, may likewise be located throughout the city, but only if a special exception is granted by the D.C. Board of Zoning Adjustment (BZA).

Yesterday's landmark action, taken by a vote of 3 to 0, stems from a trend -- spurred in many cases by court orders -- to move persons from hospitals, jails and orphanages into the community whenever possible. The District is under court orders to do wo with residents of Forest Haven, its facility for the retarded, and St. Elizabeths Hospital.

Since current zoning regulations generally permit such group homes in the densest residential zones -- R-4 and R-5, in the planners' jargon -- they have been concentrated in larger old dwellings in the 14th Street corridor and the Adams-Morgan area north of downtown. Residents of those areas have protested to city officials that they have too many of the move than 600 existing facilities in their midst, often creating disturbances and social problems.

The new regulations have been under consideration for at least five years, and deliberations leading to yesterday's decision began in 1978. The new regulations will go into effect after the commission adopts its formal order, probably next month.

Under the new rule, the traditional terminolody, including the phrase "halfway house" itself, will be eliminated. All such homes will be eliminated. All such homes will be called "community-based residential facilities." There will be seven types of such facilities -- youth residential care homes, community residence facilities, health care facilities, emergency shelters, youth rehabilitation homes, adult rehabilitation homes and substance abuser homes. Each type will be subject to its own rules.

Under the new rules, which seem certain to stir intense controversies, all such homes may legally be located in the future in even the most costly and exclusive neighborhoods, such as Spring Valley or Cleveland Park. The owner of a home who meets basic requirements will have an absolute right to house up to four persons.Subject to limitations on the spacing between such facilities, owners may house up to eight persons. Even in areas zoned R-1 for single family homes on large lots, a BZA exception may permit up to 15 residents for all types of residential and health facilities and up to 8 for correctional facilities.

In general, only one home may be located on any city square block, with a minimum separation of 1,000 feet in zones R-1 through R-4 and 500 feet in other zones. Existing homes will be permitted to continue operating as long as they maintain valid occupancy certificates.

About 75 mentally retarded children and teen-agers sat in the audience throughout the afternoon. Vince Gray, executive director of the D.C. Association for Retarded Citizens, said they were there to protest what his group considers overly strict rules that will apply to homes for the retarded.

Voting for the new regulation were Ruby B. McZier, John G. Parsons and commission chairman Walter B. Lewis. Lindsley Williams, a new commission member, did not vote.