I have a friend who is a lawyer. I asked my friend about this situation. I assumed that the dojo is in the U.S.
My friend stated that discrimination is only illegal in the sense of providing employment or government sponsored benefits. My friend did not believe that it was gender discrimination to have the man in question train only with male students. My friend also believed that it would not be discrimination to refuse to accomodate the man at the dojo.
My friend believed that the only situation that might be discrimination is if the man in question was forced to train with female students. Also, If the dojo is taking government money, through grants or government assistance, then it would be required to try to accomodate the man.
The only requirements for a 501(c)(3) that does not take government money is that 1. it is not set up to benefit one person more so than others and 2. you can't lobby for political candidates. Here is the IRS link with details.
I have tried to give answers about the legal question. My information is being related second-hand and I am posting anonymously, so this is not official legal advice.