Like how do you know you deserve to be loved and how do you know a prisoner deserves to be in prison.
You know because you decide.
There isn't a finite amount of love - it's a concept, it can't run out. So there is no way to measure who deserves more or less of it. It just is.
You decide what you are willing to give yourself. I understand that it's hard - that's why it's easiest to start self-compassion stuff in small steps. Try and do a nice thing for yourself, or identify one thing about yourself that you can see as good.
And it's the same with bad: it's utterly subjective. So you decide what you are willing to make yourself carry.
If I put someone in jail for 20 years because they were from the same town as a person who committed a major crime - well, most people would say that I am giving a 20 year sentence to a person who did nothing to deserve it.
Try and see the weight you carry, the bad stuff, as something tangible. Like weights racked up on a barbell.
Would you give that to a person who was just walking by? No - because they don't deserve it.
Try and see - Someone else gave you that weight you are carrying. The perpetrators loaded up the bars. They put it on your back. You did nothing to deserve it. You've just carried it for so long that you've convinced yourself that there must be a reason....but there isn't one.
It's a thing that happened
to you.