Anorexia nervosa, often referred to simply as anorexia, is an eating disorder, characterized by low weight, food restriction, fear of gaining weight and an overpowering desire to be thin. Many people with anorexia see themselves as overweight although they are, in fact, underweight. They also often deny that they have a problem with low weight.
There is no religious or ethical responsibility for things we cannot control. So, if you cannot control your actions, there is no sin.
However, if you refuse to eat and it harms you or leads to death, and if you can control this and have a free choice, then it is a sin, because it is a sin to harm yourself.
Whether or not you can control this is something you can decide; there is no benefit in being guilty over something which you cannot control, because it will probably just make things worse and add anxiety.
Inshallah I hope you will find a solution that will help you to be free from this problem.
It is a sin to waste food but it is not s sin to give it to others to utilize it when you don't want to eat it for any reason.
Your mental condition needs proper treatment to be a normal person with out anorexia or any other abnormality.