1. He's really rude
2. He likes you and doesn't want to seem like it so it goes too far in the other direction
3. He likes your friend and thinks you're so hideous that he doesn't even want to speak to your face in public
Why don't you try casually asking him what was up with that?