Hello and thank you for using the Just Answer website. I look forward to assisting you.
Unfortunately, unless the cause of the compressor breaking was due to negligence on the landlord's part, they would not be legally responsible for the break down of the refrigerator and they would not be responsible for the loss of your food. This is a very common situation.
With respect to deducting the money from the rent, the law is clear that you cannot do that. The only time that a tenant can deduct from the rent is for repairs not done and the specific reasons when that is allowed vary by state. Generally, in most states, the repair or deduct laws require written communications between the tenant and the landlord, clear proof that the landlord refused to repair, and proof that the landlord has a legal duty to repair.
If this was a situation where the landlord did not repair the refrigerator and refused to, that would be a different scenario. However, if the refrigerator was repaired, you cannot deduct from rent for food lost. The law simply does not allow that, regrettably, and so if you did not pay your full rent, the law does allow the landlord to evict if not paid by the tenant.
Please let me know if this has answered your question.