First, I think it would be helpful to get to the bottom of why the dean is behaving this way.
One theory I can think of is that the dean may be intentionally putting obstacles in your path, perhaps hoping that you will drop the complaint and save him the headache of dealing with it. Perhaps he doesn’t believe your complaint, or is friends with the professor and wants to believe your complaint is false or exaggerated, or simply thinks protecting his institution’s interests requires him to automatically defend any faculty member and make life difficult for any student complaining against them.
Alternatively, he may be worried that the situation is so delicate that any interaction between you and the professor is risky and could lead to bad things happening to you, which would lead to more trouble for his institution, so such interaction must be avoided at all costs, and the only way to avoid it (other than removing the professor from teaching to class, which he may not feel comfortable/allowed to do while the accusations are still being investigated) is to instruct you not to attend class.
The first scenario, where the dean is actively opposing you out of spite or bad faith, is more problematic than the second, where his intentions may be decent but he has simply made a bad call. (Actually the decision to separate you from the professor may not be terrible given the situation, but he hasn’t thought out the implications of you not attending class - it is essential that he provide you with a way to mitigate the harm this would do to your studies.) But in any case I assume you have better insight into the dean’s motivations based on your interactions with him.
So what should you do? You need someone who knows the system and its rules and can advocate for you. Normally I would recommend going to someone from the administration, but here it’s the administration that is mistreating you. Fortunately, many institutions have third party groups and resources protecting students’ interests and/or offering impartial advice. Two I can think of are:
My suggestion is to go talk to one or both of those, tell them the details of the situation and ask for help.
The bottom line is that being told to successfully complete a class under a professor who is bullying you without being allowed to attend class does not sound to me like a reasonable or acceptable way to address a complaint by a student, so you are quite right to be concerned. Good luck!