You do not think you are ugly. Do not care about what they say. It is very bad behavior to say that someone is ugly. Try to find nicer friends.
They are saying so, because they have found that you are vulnerable. You might:
- Complain to the teacher or headmaster that they are harassing you.
- Talk back to them. Say "You must be very insecure if you have to say things like that to booster your ego".