Hartford Deputy Mayor Nicholas R. Carbone, a liberal with links to the Carter administration, failed tonight to defeat Mayor George A. Athanson in the city's Democratic primary.

Carbone, 42, tried to use a sophisticated campaign organization to overcome image problems in this city of 150,000. He pinpointed exactly where his votes were, but it wasn't enough. With 31 of 32 princincts reporting, Athanson led Carbone 10,300 to 6,734.

Athanson, 52, has been mayor since 1971. His record has been bland, with heavy emphasis on ceremony. He is known for his gregarious nature and his attendance at every social event from community breakfasts to church suppers.

Carbone argued throughout the compaign that Athanson had abdicated his mayoral duties and that Athanson had no enemies because he never made hard decisions.

Athanson ran against Carbone as if Carbone were the incumbent, blaming the city council leader, who also serves as deputy mayor, for many of Hartford's problems, including the 1978 collapse of the Hartford civic center coliseum roof, mismanagement of the city's federally funded employment program and low morale in an understaffed police department.

Capbone has an established reputation outside Connecticut, with connections to the Carter administration -- outsted U.N. Ambassador Andrew Young endorsed him last week -- and friends in new left organizations around America.

But at home he was attacked as a political boss friendly to big business, particularly Hartford's many major insurance companies. Neighborhood groups contended he had ignored their needs while favoring downtown development.

Hartrord has a mayor-city manager system of government, but the city manager is responsible for the day-to-day running of the city. Carbone, in his 10 years on the council, has been the true policy leader for Hartford. He tried to show that an angry politician, one who uses agitation to achieve social change, could continue to be a successful politician.

Athanson's victory in the primary was tantamount to election in Democrat-dominated Hartford.