You don't need to 'ditch' them. If they make a joke then it's a joke, you can still try hard and get good grades, while remaining friends with them. If they're decent they aren't gonna mind you revising instead of going out every once in a while.
If they actually try to stop you (by purposely stopping you working) then yeah avoid them, but I doubt they'd do this, it'd be pretty hard for them to.
If they don't want to hang around with you any more because you are working too much, that's them ditching you, just ignore them and move on because they aren't worth it.