District Mayor Marion Barry holds a virtually insurmountable lead in the Sept. 9 Democratic primary race, but his job approval rating has plunged from 65 percent to 50 percent in the past 18 months, according to a new Washington Post poll.

The survey, completed last week, shows disapproval of Barry's overall performance increasing by almost half -- from 26 percent to 38 percent -- since the last Post survey on the subject in December 1984. This erosion is reflected in mediocre to poor ratings for Barry's handling of drug abuse issues, prison overcrowding, corruption and other city problems.

Nevertheless, Barry, who is seeking a third term this fall, is far out in front of his Democratic challengers in the Democratic primary race and leads D.C. Council member Carol Schwartz, the only Republican candidate, by more than 5 to 2.

The sharp drop in Barry's job approval rating comes despite indications of a thriving local economy, including the lowest unemployment rate in 12 years, and a national political trend that has favored incumbent state and local candidates in the past two years.

"The 50 percent is a strong base," Barry said Friday, vowing to raise his approval rating in the campaign this summer. "As we work to explain our vision of the city, we have got to go up. I think those are numbers that scared some of these potential opponents out of the race."

The decline since the last Post survey, Barry said, could be attributed in part to the conviction in December of Ivanhoe Donaldson, a former deputy mayor and close political adviser, on federal fraud and obstruction-of-justice charges.

"I think the thing that made it lower is that there is no way I can explain the Donaldson thing to the satisfaction of some people," Barry said. "There are people who think there is no way I couldn't have known what was going on. It's just not true."

In a striking irony, those polled gave the city glowing grades as a place to live -- only 7 percent said it was below average compared with other cities -- but at the same time many expressed concern about the city's future.

When asked whether the District generally was going in the right direction or had gotten seriously off on the wrong track, 47 percent responded that the city was on the wrong track and 42 percent said it was headed in the right direction.

The poll of 1,063 residents, conducted July 12-16, revealed a strong racial component in the division of opinion about Barry's performance, with 57 percent of blacks approving and 58 percent of whites disapproving. Barry attributed the split to "bias," contending that blacks and whites living in the same precincts and sharing the same socioeconomic status sometimes respond to him "almost 180 percent different."

"I consider myself mayor of all the people," he said. "All the people in the city are my constituents."

The survey shows that D.C. residents fault Barry on a number of issues, particularly prison overcrowding, which was fresh in their minds during the polling period because of an uprising and massive fire at the city's Lorton Reformatory complex July 10.

D.C. officials with responsibility for city contracts fared poorly in the poll -- only one in four respondents gave them good or excellent ratings for honesty and ethical standards. In contrast, Barry's personal ethics were rated excellent or good by twice as many people.

Huge majorities identified unemployment, drug abuse, poverty, crime, education, corruption, homelessness and housing costs as serious or very serious problems.

On the prison issue, city residents, by a ratio of 2 to 1, said they disapprove of Barry's handling of overcrowding. The mayor, characterizing prisons as a "no-win issue," said he believes that the negative rating may have resulted in part from the recent Lorton Reformatory disturbance.

Respondents were asked whom they would vote for if an election were held today. In a hypothetical Democratic primary, Barry polled 56 percent of registered Democrats, with Democratic challenger Mattie Taylor garnering 7 percent of the vote and nearly a third of the respondents saying they were undecided.

When all respondents were asked whom they would vote for in a general election pitting Democrat Barry against Republican Schwartz, the results were 59 percent for the mayor and 23 percent for Schwartz. The rest were undecided.

Schwartz, a former D.C. school board member from Northwest Washington and a first-term member of the council, declared her candidacy for mayor June 24. She said the poll indicates she has a solid base of support early in her campaign.

"I am encouraged that at the time this poll was taken, which was just two weeks after my announcement, that one quarter of the population of this city in a random poll said they were going to vote for me," she said.

Taylor, a former school board member and ex-deputy director of the D.C. Department of Employment Services, said Barry's strong showing against other Democrats mystifies her but that she has no intention of bowing out.

"I cannot explain why the people love him so," she said. "I am going to be standing up for what I believe . . . until the last vote is counted and even after the last vote is counted."

Breakdowns of the polling results show sharp delineations in the support for Barry and Schwartz.

Barry was the choice of two of every three black voters, while less than a third of whites would have voted for him in a contest with Schwartz. The Republican council member, who is white, polled a 43 percent plurality of the white vote, with a quarter of whites undecided.

The District's population is 70 percent black, and 80 percent of the city's 264,943 registered voters are Democrats.

The poll suggests that a great deal of Schwartz's support derives from anti-Barry sentiment. Six of every seven people who supported her said they disapprove of Barry's performance. Another indicator is that more white residents said they would vote for Schwartz than said they had a favorable opinion of her.

In a geographic breakdown of the polling results, the mayor did best in Ward 8, in Southeast, with 70 percent favoring him, and in Ward 4 in Northwest, with 69 percent. The two areas, are, respectively, the poorest and richest black-dominated districts, according to city figures. Barry also tallied 66 percent of the vote in Ward 7, in Southeast and Northeast, which is the mayor's home ward.

Meanwhile, in Ward 3, west of Rock Creek Park, which is Schwartz's home and the only area with a white majority, Schwartz outpolled Barry 44 percent to 30 percent, with 27 percent undecided. Schwartz also made a strong showing in wards 1, 2 and 6, which include central and Southwest Washington and the Capitol Hill area, where the white vote is a key factor.

Barry won election as mayor in 1978 largely with the support of voters in Ward 3 and, to a lesser degree, support in wards 1, 2 and 6.

Barry's rating in the poll, as traceable by race and ward, were mirrored generally in respondents' views about the mayor's honesty and ethical standards. The mayor scored lowest on ethics questions in wards 2 and 3 and highest in wards 4, 7 and 8.

The poll showed that men, by a score of 58 to 45 percent, were more likely to approve of the mayor's performance than were women.

The issue on which Barry scored the lowest in assessing his job performance was prison overcrowding, with 58 percent disapproving and 26 percent approving. Barry, who has been criticized for not doing enough to alleviate a severe shortage of prison cells, has proposed to build a 700- to 800-bed drug treatment facility and prison in the District. Some Barry critics have said the institution should be elsewhere.

Of those polled, 52 percent said a new prison should be built in the District. But among those, a majority would oppose having it built in their neighborhood. In all, eight of every 10 residents surveyed opposed a prison in their neighborhood.