You can take it any time. I would suggest taking it 6 months at least before your application. I'm using Kaplan's books (the regular guide and the 800 supplement).
I'd suggest that you take it after you graduate, since it's next to impossible to get into a good MBA program directly after undergrad. I have a friend who recently took hers, and she graduated the fall of 2002.