If this person is not the child's other parent, then you can ask the Court at the trial (or at a hearing for temporary custody) to include a term in any custody and parenting time plan to limit the child's contact with this person. This term would apply to the other parent's time spent with the child.
If this person is not seeing the child during the other parent's parenting time, but is instead encountering them at school or some other 'neutral' public location, then it's a lot harder, and not a proper subject for the divorce at all. The divorce case is a suit between you and your spouse; you can't do anything in it that restricts the rights of third parties. You'd need to sue this person themselves, in a restraining order proceeding. In order to get a restraining order, you'd need to demonstrate that this person has repeatedly engaged in conduct that objectively makes you afraid for your own safety, or a child's safety. Merely having mental health problems, without more, does not count. Lots of people have mental health troubles of one sort or another, and they're not all prohibited from having contact with all minors ever.
If this person IS the child's other parent, then it's a lot harder. You'd have to demonstrate that they presented a risk of serious harm to the child, to deny them any contact at all. Even then, they'd likely get some contact, supervised by someone.