drink during class, that will affect your ability to study. If you stay up too late drinking, having sex, doing drugs...same thing.
Also, if you are prone to guilt for sexual immorality, that MAY distract you from your studies enough to make you a worse student, yes.
But, if you think it's distracting worrying about whether God is mad at you or not for what you did with your girlfriend last night, try wondering if what you did is going to get you kicked out of school too.
So even if that WAS the reason BYU tries to keep kids sexually unscathed, they're not only fighting a losing battle, but I think their current policy actually makes it worse.