Childrens father only wants to see our 3yr old son.

So I’m currently 21w pregnant with a baby girl. My ex “doesn’t want a daughter” and says he only wants our son. He is going to court for visitation so he can make sure he’ll stay in our son’s life but has no desire to be in our little girls life. Recently it’s been weighing heavy on me and I’m not sure how I should go about things. I don’t want him picking and choosing what child to be a father to and I feel like he should either be around for the both of his children or none. As a mother is there anything I can do to prevent my daughter from the heart ache of watching her brother constantly visit THEIR father while being left out? Can the courts do anything? Has anyone dealt with a situation like this?