Good Morning A.luc
I am so very sorry to hear that you are going through such a tough time at school with your friend, it is so wonderful you have found yourself here at talking, we are here for you and to support you.
I can hear how torn you are by feeling hurt and betrayed by your friend as well as totally confused as to why he would treat you like this if he is indeed your friend. Friendships are really tricky to manage and especially if you are feeling very vulnerable in the friendship even more sensitive.
Are you in a position to put it to your friend and make him perhaps explain his way of treating you..something to the effect of.." Hey X, that is really not cool when you speak to me like that, have I done something to upset you or is there something you want to chat about?"
I also hear how much you want to be this person's friend however bad behaviour is not acceptable from anyone and you almost have to teach him how to treat you and let him know that you do have feelings and that you wont tollerate him treating you like that. It is ok for him to have other friends and to sit with other people but it is not ok for him to hang out with you one moment and the next make you feel very bad about yourself.
Are there some other people that you can spend some time with? I know this is tough as you want to spend it with your friend but making new friends will help too I think.
I am so very sorry you are going through this and I am not sure if I have helped you in anyway A.luc
Come back and chat anytime
Hugs to you