The District of Columbia has increasingly become a city of the rich and the poor, as middle-class families, particularly blacks, left in large numbers during the 1970s, new census figures indicate.

With inflation taken into account, the number of middle-income families in the city fell by 31,550 or 27 percent from 1970 to 1980, the census reported. The number of low-income families rose by 6 percent, despite an overall population drop of almost 119,000. The number of high-income families in the District increased by 4.1 percent as substantial numbers of blacks joined the sizable group of upper-income whites living in the city.

However, blacks accounted for almost three-quarters of the loss in middle-income families from the District. The proportion of blacks in city population remained stable at slightly over 70 percent from 1970 to 1980 after rising sharply since World War Two.

"We used to have a very large black middle class in the District, but we're losing it now," said George W. Grier, a demographer who studies area population trends for the Greater Washington Research Center. "We lost the white middle class decades ago."

In the Washington suburbs, where both the number and proportion of blacks more than doubled while the white population slightly declined, the number of high-income families rose more substantially during the decade than any other income group, climbing by 45.8 percent.

The number of low-income families in the suburbs rose by 25.9 percent, compared with only a 10.4 percent gain for middle-income suburbanites. But poverty in the suburbs remains slight. Those with low income account for just 9 percent of all suburban families compared with 27 percent of all families in the District.

Larry Long, acting chief of the Center for Demographic Studies at the U.S. Census Bureau, said a loss of middle-income families--black as well as white--is probably occurring in big cities across the country. But he said the new figures for Washington are the first data released from the 1980 census to show the change in incomes in any particular city.

"There's been a great deal of speculation that lower-income black families have been displaced to the suburbs," Long said, because of the boom in inner-city real estate prices and the renovation of old housing in downtwon Washington.

Instead, Long said, the new figures indicate that most of Washington's poor "have been shifted around inside the District of Columbia while the middle class is moving out."

"The city seems to be increasingly made up of persons at the opposite ends of the income scale who make very opposite demands on the city government," Long said. "That can make for great conflicts and a lot of problems for the mayor."

The new D.C. figures are included in a provisional report, released last week, on social and economic data based on a sample of 1.5 percent of the population counted by the census in April 1980.

Daniel Burkhead, a Census Bureau statistician, suggested that middle-income black families are probably heading to the suburbs for the same reasons that whites moved before them, seeking better housing and schools. "The very poor can't afford to leave the city," Burkhead said, "but for those who are somewhat better off, you can buy something nice in the suburbs for what it costs to rent something decent in the city."

Long said that despite substantial rent increases and condominium conversions in some parts of the city, the District still has many more low-rent apartments, many with government subsidies, than the suburbs. Indeed, the median rent in the city was $228 in 1980, compared with $296 for the entire metropolitan area.

"The low-income families can't afford to give up the (welfare and housing) benefits they have in the cities," Long said. "These alleviate poverty, but they may restrict the mobility of the poor. They may keep them in the city rather than move to the suburbs or the Sun Belt, where the jobs are."

Long said one other reason for the increasing number of poor in the city has been the sharp rise in female-headed households from 28.7 percent to 44.7 percent of all families with children in the District. In 1980 50.4 percent of all D.C. black families were headed by women, up from 31.3 percent in 1970. For D.C. whites, 15 percent were headed by women, compared 13.9 percent a decade earlier.

During the decade the number of high-income black families rose by 57 percent. But the number involved was still small. Blacks now account for about 35 percent of all high-income families in the District, though only 4.8 percent of all D.C. black families are in this category compared with 29.4 percent of all D.C. whites.

All the new income data is for 1979, the most recent year available when the census was taken. In the analysis prepared by The Washington Post, low income was defined as below $5,000 for 1969 and below $10,000 for 1979 to account for the virtual doubling of consumer prices over the decade. Upper income was defined as over $25,000 in 1969 and over $50,000 in 1979. Middle income covered all families between low and high.