A North Carolina man pleaded no contest yesterday to six criminal charges that he violated the District of Columbia housing code by failing to provide heat and hot water to tenants in three Columbia Heights buildings he owned and managed.

In return for the plea from Robert S. Farmer, 52, of Greensboro, N.C., the city government agreed to drop 30 other housing charges it had brought against him in February.

Farmer is scheduled to be sentenced Dec. 13, and could face up to 60 days in jail and an $1,800 fine.

In January, tenants in Farmer's three buildings successfully brought a civil suit charging that the landlord had failed to supply them with heat and hot water since October 1981.

In the civil case, D.C. Superior Court Judge William S. Thompson sentenced Farmer to 90 days in jail and a $300 fine for failing to respond to repeated court orders to provide adequate heat and hot water to the tenants at 1014, 1030 and 1034 Euclid St. NW. Farmer immediately appealed the decision and that appeal is pending.

A $5,000-a-day fine was also imposed by Judge Thompson and was to continue until Farmer had made all the required repairs. Farmer's attorney, Charles W. Halleck, said yesterday that a new furnace had been installed in one building and repairs made in others and that the question of how much, if anything, Farmer owes in fines had never been resolved. Attorneys for the tenants said they will file a motion next week seeking an answer to that question.

The day Thompson sentenced Farmer for civil contempt, the city government charged the landlord with 36 violations of the District's housing code. Violating the housing code is a criminal offense.

Trial on those charges began earlier this week, with Halleck arguing that Farmer was not responsible for the buildings because he had sold them. In announcing the plea agreement yesterday, Halleck said that although Farmer was not the owner, he was responsible for maintaining the buildings.