Yes, they can refuse to hire for this reason. Marijuana is still a controlled dangerous substance or illegal drug under federal law, even if medical marijuana is allowed under your state's laws: being a federal contractor, they have to follow federal law on the subject and can refuse to hire someone using marijuana, even if legally under state law.