Schools do not really put a limit on how many times you can retake a class, but you wouldn't want to have the same class and grade show up on your transcript more than 2 times.
If you have failed it a couple of times already, i think maybe you should not take this class anymore. Clearly, you are not grasping the concept and keep taking will only hurt your grade.