Seriousley, talk to her about this.
Make sure that you have time to talk and are not going to get disturbed or have to run off to a lesson or something, and just really tell her how you feel.
Tell her that what she does really hurts you and offends you, but that when that’s not happening, you have a great time! Just tell her what you have told us, and that you want to keep on being her friend, because at the end of the day, you love her.
She might be offended and get angry depending on her mood - I would imagine some people would be defensive, but then apologize. But if you feel she’s taken it on board and seems sorry for what she’s done, and you’re happy with how things are between you, then I don’t see any reason why you can’t still be friends :)
If she just completley blows you off, or continues to be mean despite you talking to her, I think you really have to think about if you want to be dealing with someone like that. No-one deserves to have someone treat them like that. If she values your friendship, she’ll come round, and if not, then she’s losing out on a friend who cares about her very much.
I hope that you can resolve your problems together. She might be going through a tough time at home or emotionally in general, and she might be taking it out on you because you’re her closest friend. So, when you talk to her, just be gentle and within it ask if she’s doing all right. That way she’ll know you’re willing to understand why she’s being that way, if it’s for another reason.
Best of luck ^^!