In January, a Bolsover District Council officer visited the Bridgehouse Garage in Barlborough and found that the business had an active pest infestation with food items being gnawed and rat droppings in the shop area.
According to the council, Rana Forecourts Ltd, the food business operator, was immediately served with a Hygiene Emergency Prohibition Notice.
A council spokesperson said: "The food was immediately detained by the officer and all the affected food items were removed to a secure storage unit by our food safety team.
"On a subsequent visit to the premises, council officers had to remove a dead rat from the cashiers' area."
Rana Forecourts Ltd was prosecuted and pleaded guilty to four charges at Chesterfield magistrates' court.
It was stated in mitigation that a temporary manager, who no longer works for the business, had failed to follow procedures.
The court imposed fines totalling £40,000, costs of £1,790.82 and a victims' fund surcharge of £170.