President Carter's top campaign strategists realized recently that they were running a losing campaign in the District. So, the story goes, they decided to ask Mayor Marion Barry to abandon his passive support for the president and tape some radio spots with Carter before Tuesday's primary.

A quick check showed, however, that Barry had serious popularity problems of his own -- the kind that could hurt Carter more than they could help him. So, the strategists reconsidered the inexpensive radio advertising campaign and decided: Why bother?

Washington may be the seat of the presidency and the center stage of the national political drama. But in this year's Democratic and Republican presidential campaigns, the D.C. primary has been an insignificant political happening -- a forgotten primary near the tail end of the campaign schedule with few delegates at stake to matter.

"Both sides have not put any emphasis on this primary," one leading D.C. Democratic official conceded. "It's not any disrespect for D.C. It's where they had to allocate their resources. We're only 19 delegates" out of the 3,331 who will attend the party's nominating convention.

Instead, a proposal to legalize gambling has become the major attraction on the ballot. Proponents contend that it could raise as much as $20 million a year for the cash-pinched city government, but opponents are suspicious of those parts of the all-or-nothing referendum that would allow parimutuel betting on dog racing and jai alai.

For months, the proposal appeared to be a shoo-in for approval. But a surge of last-minute opposition -- including an unusual appeal for rejection from the U.S. Attorney here -- has made the fate of the gambling measure far less certain.

Neither Carter nor Sen. Edward Kennedy, the major Democratic candidates, has spent much time or effort setting up campaign organizations in Washington. Both candidates' local units have complained of being chronically short of campaign literature, office supplies and, most of all, cash.

Kennedy, fighting to maintain even an outside chance of wrestling the nomination from Carter, has made four appearances -- two at churches, one at a housing project and another at a senior citizens' residence. But he has bought only a handful of radio ads and no local television time.

Carter, maintaining his Rose Garden strategy, made no appearance, leaving Barry to become a reluctant chief surrogate by default. Only last week, for example, did Barry get around to putting a Carter campaign sign on his official car.

Yesterday the mayor spoke at a prayer breakfast at the 10th Street Baptist Church, just minutes before Kennedy as scheduled to arrive for a rally there. Barry spent nearly all of his time of the city's worsening financial crisis. He mentioned the Carter campaign only as he was leaving.

The city's tiny Republican party, less than one-tenth of the District's 250,000 registered voters, is embroiled primarily in spirited local flight in which a rich, older and largely white conservative faction is trying to regain control of the party structure.

In the GOP presidential contest, John B. Anderson, the Cinderella Republican turned Independent, has made several appearaces, and his supporters have reregistered more than 2,000 Democrates and Independents as Republicans.

But the real Republican Party fight won't even take place here because Ronald Reagan, the GOP front-runner is not on the ballot.

Tuesday's primary comes at a time of unease and uncertainty among District residents. Washington's economy, previously thought to be virtually recession-proof, has begun to take a downturn. The thrust toward a balanced federal budget threatens the livelihood of some of the thousands of city residents who work for the federal government.

In addition, the city government is in the midst of the worst financial crisis in its history, one that has resulted in layoffs and sharp cutbacks in city services. The whole notion of home rule is beginning to be quietly questioned.

District voters, like those in many other parts of the country, appear to have barely noticed the presidential contest, or have little hope that its outcome will make a difference, many observers said.

City Council member Polly Shackleton (D-Ward 3), a veteran Democratic activist, said: "I think the fact is a lot of people are not for Carter and not for Kennedy and they are not for Reagan and they are not for anybody."

"People are concerned about their own self-preservation," said R. Robert Linowes, a politically active Washington lawyer, "about inflation and the need for careful planning just to survive."

The Carter campaign in Washington has been plagued by not only a lack of support from the national organization, but also inaction and internal dissension at all levels, according to many within the campaign organization.

Barry, who once said he was personally fonder of Kennedy, nevertheless endorsed Carter, who as president, has significant influence in the local affairs of the nation's capital. The mayor then "insisted" on being chairman of the local Carter effort, according to one prominent Carter supporter. But until last week, Barry was all but invisible on the campaign trail.

"Marion made the endorsement, but never followed through," said one City Council member, pointing out that many of Barry's supporters and political allies are in the Kennedy camp. Asked where Barry had been, a local Democratic Party official and Carter backer said: "That's what we'd like to know."

The Carter effort also has suffered, insiders say, from jealousy and bickering among elected officials who have endorsed the president. The list includes some well known political rivalries, like Barry City Council Chairman Arrington Dixon and Barry versus Council member Willie J. Hardy (D-Ward 7).

With many of the local politicians angling against one another for political prominence in the future, there has been a reluctance to share the coveted lists of loyal campaign workers who could be drafted to form a city-wide Carter machine.

Some Carter backers have griped that Jannette Hoston Harris, handpicked by Dixon to coordinate the local effort, is a political neophyte with little campaign experience. In the final days of the campaign, the national organization sent over trouble-shooter W. C. Bradley from Atlanta to patch things together. But, one top insider grumbled the other day, "He didn't cut it either."

At one point, delegates pledged to Carter were almost thrown off the ballot in half of the city because campaign officials misinterpreted District election laws. The national organization, aghast at the prospect of having Carter delegates not listed in the precinct that includes the White House, quickly sent over an attorney who managed to win a last-minute reprieve from the D.C. Board of Elections and Ethics.

Kennedy has long been favored to win the District primary, and Carter campaign officials acknowledge this.

"This is Kennedy country," said one top Carter supporter privately. "Bobby won it in '68, his brother won it in '60. We're not unmindful of the fact that Kennedy has some strength. If we get 35 or 40 percent, that's a victory. All we want is a respectable share."

The local Kennedy campaign also has been virtually orphaned by its progenitor. But unlike Barry, its major surrogate, Del. Walter E. Fauntroy, has been active on the campaign trail in recent weeks. Fauntroy himself is on the Tuesday ballot, but he is unopposed for nomination to a sixth term.

Fauntroy has been called upon to improve Kennedy's standing in many older, middle-class, black neighborhoods where Carter is considered stronger. But much of the support Kennedy organizers are counting on is expected to grow out of the senator's four appearances here, where what Fountroy calls "the Kennedy magic comes into play.

As Kennedy arrived at the Roosevelt senior citizens' apartment house on 16th Street NW to give a short speech recently, a portly, middle-aged woman squeezed through the crush of reporters, Secret Service men and campaign workers to shake his hand.

She dashed back into the building, loudly proclaiming, "He shook my hand! He shook my hand!" A reporter asked her name. "My name is Evelyn Olivia Black, and he shook my hand!" she said.

Black, 59, lives in Northwest Washington and has been desk clerk at the Roosevelt for ten years.

Anita Bonds, who was deputy director of Barry's successful 1978 mayoral campaign, quit her job as a special assistant to Barry in order to head up the local Kennedy effort. By all accounts, the Kennedy effort has been a bit more effective than Carter's, though, as one Kennedy backer said: "I'm not terribly impressed with either campaign."

One of the city's most effective political blocs, the gay community, has lined up solidly behind Kennedy.

"We'll have a phone bank and several hundred workers on election day," said gay activist Paul Kuntzler. "I think we can deliver around 80 percent of the gay vote."

Despite the predictions of a Kennedy victory, veterans of the political scene recall that Carter won a surprise victory in the 1976 D.C. primary with a strong get-out-the-vote effort. Leaders of one traditionally liberal group, the Hispanic community, have rallied behind Carter, and Kennedy strategists concede that the vote in the largely Hispanic Adams Morgan neighborhood might be close.

The Carter campaign is highlighting Carter's positions on issues that directly affect the District, including the president's support for the D.C. Voting Rights Amendment and his support of a fixed formula for the annual federal payment to the District.

Carter backers also highlight the president's urban policies, which they call the first coherent approach to rebuilding the nation's inner cities. And they point to the fact that most big-city mayors have endorsed the president.

The Kennedy campaign, hoping to capitalize on national economic woes, has hit hard on economic issues, with Fauntroy repeatedly attacking Carter's policies as "essentially those of a Republican." Kennedy's people blame the president for high interest rates and a failure to control inflation, and trumpet Kennedy's support of full employment as the cure for the nation's economic ills.

The local Kennedy campaign has followed Kennedy's lead in not criticizing the president's handling of the Iranian situation.

Kennedy forces hope to run strongest in Ward 3, the affluent and mostly white area of the city west of Rock Creek Park, in Wards 7 and 8, east of the Anacostia River, and expect to be "relatively strong" in inner-city Wards 2 and 6, according to Fauntroy.

The Carter campaign hopes to pick up support in Wards 4, 5 and 7, the outer fringe of the city east of Rock Creek Park. These wards have the highest concentration of Democrats in the city and voter turnout in these areas is traditionally among the highest in the District.

In addition to the presidential contest, there is separate voting on Tuesday's Democratic ballot for membership on the Democratic State Committee, the policy-making body that sometimes makes interim appointments to the City Council.