As an undergraduate student(and a so-called nerd), I have had friends who requested academic help a day or two before exams. Now, I don't have much problem with helping them and I try my best to do that. However, you can't help everyone all the time.
I learnt that the hard way in my mid-term exams because I didn't work enough on my weaknesses because most of my time was spent clearing any doubts(Solving the questions) my friends had. And those questions hardly ever overlapped with my weaknesses. Hence, my weaknesses remained exactly that.
How do I refuse to provide help?
Now, in my culture, it is sort of expected that if someone is good at, say, academics, they should help out the ones who are not so good at it. So, a direct no tends to harm relations with friends and also leads to you being seen as an arrogant jerk. I can tell them to come at a later time but they usually return at another time when I am even more busy and further excuses only serve to adversely affect relations. (Note that: There is no severe deterioration. It is just that, it doesn't help with how people see you, and trust me, in my culture, how people see you, is very important)
I have tried going to the library more often to counter this problem but the atmosphere in a library doesn't suit me and hence, even that is not an option.