Once you have gelded the stud horse, it will no longer have the desire to breed any mares, provided the castration is done properly, once all the testosterone has cleared his system. It doesn't matter whether he has bred 1 or 50 mares; after he is castrated, his desire to breed is removed, and it will be much easier to manage him and take him in the direction you want him to go.
The following is an article concerning Castration: Creation of a gelding from a colt or stallion