I've been asked to take a drug test that I think I'll fail.
Holy shit friend - you ARE in some pickle juice. First things first, get your hands on your company’s drug policy. If your boss is “by the book” assume he/she will follow the policy to the letter. Because post-employment, random drug tests aren’t common place yet (save for an on-the-job workman’s comp type incident) there may be a chance the company policy is ambiguous.
If there’s no clear position, I suggest you bite the bullet and come clean with your boss. If you’ve done a good job for them and are considered a valuable employee (which, your recent selection for this plum assignment tells me that’s the case) then they may be willing to work with you. Your position should be that since there’s no clear company policy, you didn’t understand this level of compliance to be a condition of employment. Which, based on your panic, I’m going to assume is true. So claiming genuine ignorance, coupled with a good work history, could get you a free pass. Prepare to be removed from the project, but hopefully your advancement potential is saved. Keep in mind there will be an asterisk next to your name for a while - work hard to erase that bitch.
On the other had, if the policy says failing a drug test is cause for immediate termination, then I’d dance with the devil. Research every crack-pot (pun intended) system cleanse idea you can find (reddit is a good place to start) and throw all your energy into passing the test. At the same time, dust off your resume and start poking around your (trusted) network of contacts to see what your options are. The good news is, it’s an employee’s market right now, so if this is your worst case scenario, you shouldn’t be on the street for long.
And lastly, days (hell, hours!) matter in this situation. If there’s any way you can wrangle a couple days off to stretch the time between now and test day, take them. Then take your piss and say a prayer. I know I will.
Good luck to you. I mean, good luck to your friend ;)