Tell him:
I love you. But you need to love yourself. The way you're managing indicates that you don't love yourself enough and you need me to chase after you to cover the part of yourself that you don't want to cover.
I don't want to chase after you, because loving yourself is YOUR job. I'm here to help you but there'll be one day that I can no longer help even if I want to.
Spend time with him when it has nothing to do with school.
(Kids get attention from parents whichever way they can.)