A North Carolina man charged with failing to provide heat and hot water to tenants in three Columbia Heights apartment buildings received a suspended 60-day jail sentence and $600 fine yesterday and was prohibited from being a landlord in Washington for the next five years.

Robert S. Farmer, who had pleaded no contest to six housing code violations, could have been fined as much as $1,800 and given 60 days in jail. D.C. Superior Court Judge Byron W. Sorrell issued the sentence in what city attorneys had called a test case in a new program aimed at landlords repeatedly charged with code violations.

D.C. Corporation Counsel attorney Nathaniel H. Speights declined comment on the sentence. "We are going to continue to enforce the housing codes vigorously," he said.

Farmer was arraigned in February on 36 counts of violating housing codes at apartment buildings located at 1034, 1014 and 1030 Euclid St. NW by failing to provide heat, hot water and plumbing. In a plea-bargaining arrangement with city attorneys, 30 of those counts were dropped in exchange for Farmer's plea of no contest to the remaining charges, each of which carries a maximum penalty of 10 days in jail and a $300 fine.

In a presentencing memorandum, city attorneys wrote that since Farmer bought the buildings in 1974 he had allowed them to deteriorate and had been prosecuted five other times for failing to correct violations there.

In arguments prior to sentencing, defense attorney Charles B. Halleck painted Farmer as a victim of "vindictive" tenants who had destroyed the buildings, and of rent control laws that prevented Farmer from earning enough from the properties to make repairs.

Halleck said in court that Farmer had "finally given up" being a landlord here and sold all his properties in the city. He likened him to Richard Nixon, saying: "They're not going to have Bob Farmer to kick around any more."

Halleck said in court that Farmer sold the buildings in March and that violations for which he was cited had been remedied. Farmer is appealing a ruling in a civil case a Superior Court judge made in February. The judge sentenced Farmer to 90 days in jail and fined him $300 for failing to respond to court orders to provide adequate heat and hot water to the tenants.

Speights, who asked for the maximum jail sentence against Farmer, described him as "a person who is involved in a war with his tenants" and told Sorrell that "it was only by the grace of God . . . that no one died in those buildings last year."

Speights said that the sale never was recorded and the buildings continued to violate housing codes.

Last winter, some residents in the Euclid Street buildings complained that they had gone weeks without heat or hot water. Some said they had kept their gas stoves burning 24 hours a day and slept on living room couches. Others bathed in kitchen sinks and borrowed water from neighbors. In some cases, windows were encrusted with ice.

According to Speights, the city spent more than $40,000 last winter on repairs and to provide heat to the tenants.