The government said yesterday that a controversial nickel price hike for Hershey chocolate bars does not violate President Carter's voluntary price guidelines.

The Hershey increase was one of the first announced after President Carter made known the details of his anti-inflation plan Oct. 24, and became a matter of concern at a Carter press conference the week before last.

The Council on Wage and Price Stability said yesterday that the increase, from 20 to 25 cents, works out to be 9.4 percent on the cholclate bar itself because the manufacturer is making the candy bar bigger at the same time.

The overall price increase for all products made by the Hershey Chocolate Co., of Hershey, Pa., works out to 8.9 percent. DUring 1976 and 1977, the base period for Carter's anti-inflation program, Hershey's price increases averaged 13.75 percent.

The president wants companies to shave half a percentage point from their base-period price increases to help hold down the rate of inflation.

According to the council, "Ordinarily companies are asked to enact only half of the annual price increase during the first six months of the year to be in complaince, but Hershey met the requirements for an exception to that provision, in part because the company traditionally announces its price increase for the entire year about this time every year."

The increase is due to take effect next Monday.