It depends on your body fat levels and experience. I stay extremely lean year round and within striking distance of contest conditioning so I only diet/prep 8 weeks. I have done over 20 shows so the posing and final preparation details are second nature for me.
For a first show, I would start prepping 16-20 weeks in advance so you have lots of time and aren't rushed. Again though, it depends on where you are currently at. You could need even more time then that. A lot goes into contest prep with practicing posing, training, diet etc.
I have had people come to me at 8 weeks out as kind of a 'fixer upper' client and we have pulled it off, but it isn't easy. Slow and steady is always the best.