You: Hey. You're not part of this conversation.
Douchebag: I'm not talking to you!
You: No, but I'm talking to you.
Douchebag: Ohh, scary! I'm supposed to be scared now?
You: You think I'm scary? Poor guy. You're pathetic. We don't want you here.
Douchebag: You think you'll get into this girl's pants tonight?
You: (ignore any comment like that, you don't have to answer anything he asks you) I told you we don't want you here, leave.
Douchebag to the girl: He thinks he can get you horny if he is tough.
You: She won't help you, and you won't get anywhere. Get lost.
There is no way to get rid of the douchebag without the mood being ruined. But you can show that you won't give an inch to scum like that. Don't answer any questions he asks. Don't follow any path that he tries to lead the conversation. Just keep saying he won't get anywhere here, you don't want him there, and tell him to leave. Show that no insult he tries will get under your skin; you just scoff at him with a superior half-smile, showing you know exactly who he is and what he is.
A douchebag like that will often try to puncture you by joking with the girl, who will typically be weak and politely smile an embarrassed smile out of habit. He will mock you for being tough or scary or similar. He will tell the girl that you want to have sex with her. Don't answer any of this, don't say "no" to any accusation from him, just tell him that won't work and he should get lost.