If you're allowed to create a hypothetical question that translates a hierarchy of guards into Boolean logic, then it doesn't matter how many guards there are.
"What would each of the other 49 guards would say the 49 guards other than them would do?" It would be a pain to do the deduction from all of that info, but it seems like it would be enough enough. Maybe it would make more sense to have that guard write down the answer (and throw in a pencil and a few extra sheets of paper)...
"Label the guards, 1 to 50, starting with you as 1, the guard to your left as 2, etc. For each guard, tell me what answer they would give if I asked them if your door was safe".
If all the guards say the same thing, you're talking to the lying guard. Otherwise the liar is simply the one that answers differently.