In a drastic reversal of the pattern of the previous two decades, blacks left Washington during the 1970s at more than twice the rate of whites, according to a new analysis of 1980 census data.

Many of the blacks who left, the data indicate, were people in their 20s and 30s and their children. At the same time, the population of elderly blacks increased rapidly.

Meanwhile, the number of whites ages 25 to 39 living in the city rose 33 percent during the decade. The number of whites in all other age groups in the District continued to fall, including the relatively large over-65 segment, which declined 25 percent.

Overall, the racial composition of Washington held almost steady during the decade at just over 70 percent black. The city's total population fell by almost 16 percent, to 637,651.

But the similarity in the overall rate of decline for blacks and whites masks major differences in the way the declines occurred.

For whites, with a large number of elderly and a very low birth rate, the number of deaths during the decade exceeded births by about 11,200. This difference, which demographers call a natural decrease, accounted for more than a third of the white population drop of 31,615. The white decline from net outmigration -- more people moving out of the city than into it -- amounted to about 20,400, or 9.7 percent.

Among D.C. blacks, however, there were about 42,300 more births than deaths during the 1970s, even as the city's black population fell by 89,483. Thus, the net outflow of blacks from the city was much greater than the population loss. It reached almost 132,000, or a net outmigration of 24.5 percent.

For both racial groups the patterns of movement were far different from the 1950s and 1960s. In those years -- until the late 1960s -- Washington had a strong net inflow of blacks, largely from the rural South, as blacks increased from 35 percent of the city's population in 1950 to 71 percent in 1970. The outmigration of D.C. whites was high, mainly to the suburbs. In the 1960s, for example, the net outflow of whites was 137,067, or 39.7 percent of the city's white population.

"The blacks who are moving from the city to the suburbs now appear to have many of the same attributes as the whites who moved out earlier," said Donald Starsinic, chief of the state and national estimates branch of the Census Bureau. "They appear to be people with children who are looking for better living conditions, better schools, better accommodations to suit their families. It's sort of traditional in the United States to find those things in the suburbs."

Meanwhile, the exodus of blacks from the South, which traditionally supplied most of Washington's black newcomers, virtually stopped after 1970.

During the 1970s, the number of black children under 15 in the city fell by 42 percent. The decline stemmed from fewer births, a nationwide phenomenon, and the move to the suburbs. It produced a drastic drop in the city's public school enrollment. The 20-to-39 age group, who often are parents, fell by more than 8 percent. Indeed, the only age group of D.C. blacks to increase after 1970 comprised those over 55, usually "empty-nesters."

Among whites, the number of children already was very small in 1970 and slipped by 35 percent more in the following decade. However, for the first time since 1950, white young adults ages 25 to 39 increased substantially in D.C. -- from 42,336 in 1970 to 56,023 in 1980. Many are members of the enormous postwar baby-boom generation. The increase in their numbers in Washington was slightly higher than their increase nationwide.

"D.C. may be cutting its losses" of whites, said Larry Long, a research analyst for the Census Bureau. "More of this generation seems to be staying in the city. Maybe they're the ones who are bidding up the price of condos."

Although no detailed data is available yet from the 1980 census, city officials believe many in this group are young professionals, either single or childless couples, who have been heavily involved in the renovation boom on Capitol Hill, Dupont Circle and the edges of downtown. Many occupy houses once inhabited by larger black families, who have moved farther out in the city or to the suburbs. Their birth rate is extraordinarily low, less than half the national average, according to the D.C. Department of Human Services.

Because of the influx of these young adults and the deaths of elderly whites, who had accounted for a fifth of the city's white population in 1970, the median age for whites in Washington fell from 41 in 1970 to 35 last year.

For D.C. blacks, the median age increased during the decade from 25 to 29. That reflects the heavy loss of children and a sharp rise in elderly blacks over age 65, whose numbers increased 43 percent.

Even though white outmigration has slowed, in 1980 Washington had more blacks than whites in every age category except over 80, where whites outnumbered blacks 7,951 to 6,409. Among both races, there were 2 1/2 times more women than men in that group.

Last year the city's overall population was 53.7 percent female, about what it had been a decade before.