It’s ok for that to happen. It happens a lot in life, especially in middle and high school. The best thing to do is try and be friends with him. If you still like him, pretend he’s just a small crush you have and that you don’t know him that much. If he gets a new girlfriend, send praise and support. Maybe he’ll break up with the girl later and go back to you, but for now try to find the people that really matter to you.