A close-fought and at times rough Democratic primary campaign heads toward its suspenseful finale this week, with the careers and prestige of the District of Columbia's most prominent politicans at stake and special interest groups scrambling for powerful positions in a still evolving political structure.

The second contest in more than a century to choose nominees for mayor and City Council chairman has been an intense and sophisticated campaign. Its battle lines have defined and sharpened the often blurred boundaries of the many worlds of Washington.

Unlike the 1974 campaign, in which the incumbent mauor was elected to the job he had held by appointment for seven years and the council chairman's post attracted only token opposition, this campaign has divided many major interest groups in the city and launched others into unprecedented political activity.

In this campaign season, the politically potent black church community, once solidly behind a single candidate, is split on its choice for mayor. Typical of the divisions among businessmen, the president of the largest savings and loan in the city has one choice for mayor, while the president of the second largest has another. Organized labor, sensing an opportunity to establish itself as an important political force, has mobilized its own $30,000 effort on behalf of its favorite candidate.

Nearly three times as much money has been contributed to this mayor's race as was given in 1974, much of it by uncertain businessmen who have hedged their bets for future access to city hall by contributing to all three major candidates in the close three-way race.

And Washington has become a city alive with the excitment of local politics Bright, multicolored campaign logos vie for attention from thousands of buttons, posters or lampposts, kites in windows and even writing in the sky. Half a dozen original compaign jingles flare out over the radios in rush hour traffic, and thousands of campaign workers comb through neighborhoods in search of votes.

After 10 years of feeling its way through the infancy of mostly amabeurish campaigns for the city school board, virtually issue-less races for congressional delegate and City Council contests in which a well-known name assured success, local politics in the District has grown to a new stage.

"We're reaching a pretty mature level . . . The District has moved from being America's last colony to a good level of poltical culture," said Michael Barone, vice president of Peter D. Hart Research Associates a nationally known political consulting firm that has advised candidates in this year's campaign in the District.

"I think they're young adults (politically)," Matt Reese, owner of a similar firm, said of the city's politicians.

"Nobody's playing hardball yet," Reese said.If I had to grade the best I've seen with the pols in Washington and how they develop and deal with an issue, I would have to grade it a 5 or a 4 on the scale of 10.

"But I sort of think we don't want to get into the kind of hardball that you see in other places. We don't want to get cynical about the whole damned world."

Most of the winners of the Demoncratic primary in this overwhelming Democratic city are vitually assured of victory in the Nov. 7 general election.

Yet for the major politicians involved, and for the dozens of close associates who have entwined their own professional fortunes with those of their chosen candidates, the stakes in this truly winner-take-all primary - no runoffs are required - are immensely personal as well.

DeL. Walter E. Fauntroy is unopposed in the primary. But he has put his prestige as the city's most popular and influential Democrat on the line through his active support of City Council Chairman Sterling Tucker for major and Council member Arrington Dixon for Council chairman.

Fauntroy, 45, has for years been billed as the Democrat with the best political organization in the city. If Tucker and Dixon lose. Fauntroy would be hard pressed to disprove the contention of some of his critics that that popularity is not transferable and the vaunted Fauntroy organization is virtually nonexistent.

Sterling Tucker, a businesslike and seemingly unemotional former civil rights leader, has waged the most expensive campaign for major.

If he loses in Tuesday's primary all of that money will have gone for naught and the 54-year-old Tucker, a leader in District government the last nine years, will be out of public office Jan. 2.

Mayor Walter E. Washington, a convincing winner in 1974, has to win an election Tuesday in which his own campaign planners admit most voters probably will vote against him.

Washington is gambling that the sentiment against him will be so hopelessly divided between his two major opponents that he can eke out a plurality. Otherwise, this 63-year-old personable mayor of the District for more than a decade will leave office in the shame of defeat.

City Council member Marion Barry, the 42-year-old former militant turned consummate politician, has spent nearly a decade methodically building a broader political base in preparation for this campaign for the top post in the city.

If Barry loses, he keeps his at-large seat on the council and is likely to be a formidable force there. But he also will have to survive the uncertainly of four or eight more years with someone else as mayor before he could try again to be the city's chief executive.

Council member Douglas E. Moore has campaigned under the cloud of three years of controversial behavior in office including several scrapes with the law, the kiss of death from the regular party organization which has chosen to ignore him and the label of being a political "lone ranger" who could not get along with enough others on the council to get anything done if he were elected.

To offset those stigmas the fiery and sharp-togued Methodist minister has labeled himself THE candiate of the people, "unbought" by the city's business community, unconvince of the need of for gay rights and legal gambling and unbothered by those who "major in the minors" by emphasizing his controversial personal conduct. If Moore, 50, loses he, too is out of public office Jan. 2.

Council member Arrington Dixon, 35, the ambitious but low-keyed council member who has been riding the tide of an apparently strong anti-Moore sentiment, could be on the brink of a bright political career, if he wins Tuesday's primary against Moore and longshot John G. Martin.

If Dixon loses, it's back to the Ward 4 seat on the council, which would probably be under the chairmanship of Moore - the man who has publicly referred to Dixon as "boy," and "a zero" and who disclosed Dixon's arrest record - on a charge for which Dixon was not prosecuted - to the public.

In the final weeks of the campaign for mayor, it has been Washington who has appeared to develop the most momentum, surging from his low standing in the early polls into a dead-heat contest with Tucker for the lead.

Barry, the self-described underdog in the race, was fighting by the end of the week to hold on to his base in Ward 3, amidst calls by Tucker and Fauntroy for all real anti-Washington voters there to go with Tucker, the only candidate, they claimed, with enough citywide support to win.

On Friday, Council member Polly Shackleton, the unchallenged leading Democrat of that vote-rich ward, endorsed Tucker, much to Barry's chagrin. Barry did, however, pick up the official and largely symbolic endorsement of council member John A. Wilson (D-Ward 2), who has already been an unofficial adviser to Barry for some time.

The campaign for mayor has taken place against a backdrop of a capital city on the brink of economic boom and urban resurgence. All three of the major candidates have tried to lay claim to part of that success in every area from building houses and finding jobs to improving education and bettering race relations in a one-time racially taut city.

With all three candidates having essentially the same views on most major issues and having histories of local involvement dating back at least 10 years, it has been a campaign based in large measure on personality and style.

Although the media advertising campaigns in this contest reached a high degree of sophistication, the behavoir of many of the politicians showed that Washington is still largely a city of unplotted political ground.

Few candidates showed any profound knowledge of the varied sensitivities of different neighborhoods, for example. Rather, they waited anxiously for polls - either their own or those of private firms and newspapers - before acting and cautiously refrained from sharply attacking each other until the final days of campaigning.

And, while the candidates elected for the most part not to attack each other very harshly on the stump, newspapers were deluged throughout the campaign with tips from various campaign sources about stories that could be personally and professionally damaging to the political opponents of the sources.

Four years ago, many of the important interest groups in Washington were viewed almost monolithicly, but this election proved that they were more complex.

The "black church" emerged as a complicated institution with strong historical roots and a prominent political role, whose leaders often chose sides 17 political contests for a variety or reasons.

The "business community," once thought to be represented exclusively by the Metropolitan Washington Board of Trade, emerged as a multifaceted group, with its own divisions based such things as age, race and the importance of long-established ties with individuals candidates.

In the council chairman race in particular, embarrassement became a campaign theme, as one sector of the black middle class accused another of public behavior that was not to be condoned.

Unlike the popularity campaigns of the past, the winner of this year's mayoral race may well be the candidate with the most elaborate sytem for getting his supporters to the polls on Tuesday.

"By and large," Bailey said, looking back over the campaign, "the politics of this city is in better shape than the politics of most places.

"It still has some way to go in terms of organizational politics. But in many respects, it's miles ahead of other places, maybe because it hasn't had to suffer through 100 years of the kind of politics that can run down a system and create much greater apathy."