A nationally known urban liberal with strong links to the Carter administration is waging an uphill fight for the Hartford mayor's job in a battle that illustrates both the potential and the perils of social activism in the cities.

Nicholas R. Carbone, 42, the deputy mayor and strongman of the Hartford City Council, is rated an underdog against Mayor George A. Athanson, 51, the bland eight-year incumbent, in Tuesday's Democratic primary. Victory in the primary is tantamount to election in this heavily Democratic city.

Carbone is filling the airwaves with endorsement ads from retiring U.N. Ambassador Andrew Young, one of many Carter administration officials who have lent a hand to his campaign.

In 1976, Carbone was the first prominent Connecticut politician to endorse Carter. He was invited to July's Camp David summit conference, irritating not only Athanson but also Connecticut Gov. Ella T. Grasso, who is doing her best in the current mayoral race to pay Carbone back for his unsuccessful effort to deny her renomination in 1978.

Although barely 15,000 of the 37,000 registered Democrats in this city of 140,000 are expected to vote Tuesday, Carbone has been able to enlist an unusual amount of Washington interest in his $100,000 campaign.

In addition to his early support of Carter, the intense and fast-talking high school dropout has made himself something of a hero to both the ethnic movement and the new left organizations around America.

At home, Carbone is under fire for the heavy financial support he has accepted from big businessmen and downtown developers and his oftenstormy relationships with neighborhood groups.

Officers of Hartford's leading insurance companies were prominent in the audience of 1,200 at a campaign fund raiser last June where a telegram from Carter was read that praised Carbone as "a great American and a good friend."

The main speaker of the evening was Msgr. Geno Baroni, the neighborhood-movement leader and assistant secretary of housing and urban development.

John Filer, chairman of the board of Aetna Insurance, explained his support of Carbone by telling The Hartford Courant, "I don't think he's a paragon of virtue, but I happen to respect people who are movers and shakers and care about the community."

Not even his critics deny that Carbone is a mover and shaker. Since gaining a seat on the council 10 years ago, he has forged a durable majority among its members and has hammered through major decisions in closed caucuses of his allies.

Under its charter, Hartford has a weak mayor system of government. The city manager is responsible to the council, on which the mayor sits but has no vote. Over the years, Carbone has installed allies in key professional staff posts and has limited the mayor's discretion even beyond what the charter has done.

In the current campaign, Carbone has accused Athanson of being a figurehead leader, "content with signing proclamations, cutting ribbons and marching in parades."

In a debate Friday, Athanson replied that Carbone had cut the mayor's staff to two. He said his rival suffers from "the arrogance of power" and would create a "dictatorship" if he annexed the mayor's office to his domain.

Through his chairmanship of the council, Carbone has put the city government into a role of social activism unusual, if not unique, for the major cities of America.

The city finances a "citizen's lobby," which has pressured the legislature for higher welfare payments. City attorneys have gone into court to force surrounding suburbs to accept more low-income families and to open suburban jobs to city residents through affirmative action hiring programs.

It has sued the state and federal governments to force mass transit funds to be used to bus city residents to suburban jobs, and not just the reverse.

It is this kind of activism that has given Carbone his national reputation. When Jane Hartley, a White House staff member, had a fund-raising reception for Carbone at her Washington home, the guests ranged from Sam Brown, the anti-Vietnam war organizer who now heads the Action agency, to Carl Wagner, Sen. Edward M. Kennedy's (D-Mass.) political assistant.

But in Hartford, Carbone's combination of social activism and strong personal power-politics has earned him a wealth of enemies. The Hartford Courant, in endorsing Athanson, said Carbone is "knowledgeable, hardworking and willing to experiment. But he is also an angry leader who believes in confrontation politics and who has managed to enrage his suburban counterparts, the state legislature and the governor -- distinctly disastrous attributes for a city in need."

Athanson, described by the Courant as having a record that is "neither good nor bad; it is bland," has run against Carbone as if Carbone were the incumbent. He has managed to saddle Carbone with blame for scandals in the city's employment program and the collapse of the roof of the Hartford Civic Center.

Polls have shown Carbone trailing, but the council president has a hardworking organization, and in a small turnout might win.

"This is going to be the first time the least popular candidate wins the primary," Carbone predicted. But he also says, "It's time for Hartford to decide what kind of leadership it wants. I'm an activist, and I am angry about what I see when I walk through this city, and I do want change. We'll see if that's what people want now or not."