If you find you HAVE to stay away from chocolate at all costs- a food allergy, severe intolerance, or a uncontrollable sweet tooth- the only thing that will help is self control.
My mom is a chocoholic. I know it sounds silly and there are tons of jokes out there but seriously she has one and she can't stop. Many a night I would find her sitting with a pile of chocolate ice cream or a large block of chocolate. She told me that giving up chocolate is as painful and difficult as giving up smoking was. And she was not one of those luckily folks who made the decision, threw out the pack of smokes, and never looked back- she was the one who threw out the pack then dug it out of the trash and dusted it off. (Note- that is just an exaggerated metaphor she didn't actually do that.) Anyway, she finds that if she refuses to buy anything containing chocolate she doesn't have the cravings. If she has one, she wants more though. For her it's a matter of self discipline, she has to totally give it up completely. From there it does get easier, but if she breaks, she falls. So if you are similar to my mom, it's about staying firm. And remember, just like giving up smoking sometimes you need a few trial runs before you can successfully quit. If this happens, forgive yourself and move forward.
If you need accountability I suggest talking to a friend, spouse, or relative. This doesn't mean you need someone to guilt you, just that maybe it might help you to have someone say -how are you doing?
Self control.
Why do you want to stay away from it?
I was told I have a dairy allergy and cant have chocolate. It has been 3 weeks and I have had none and no cravings.