I'm not sure this works out. I know that people who operate heavy machinery in some states are tested to make sure they never, even in their free time, ingest certain things. Even legal ones. In their case it's done (IIRC) because of the impact those things can have on decision making and it's a safety issue. These situations can even be required by insurance companies to have coverage for the machinery operation.
While the case is different it does show a precedent for dictating some lifestyle choices as a matter of employment.