Basically, it’s because the emperor was becoming more more suspicious and paranoid where he doesn’t even trust his own officials unless they agreed with everything he said.
Basically it had nothing to do with the female lead and everything to do with the fact that he wanted his nephew to have absolutely loyalty to him without any outside interference. So he was using Any Excuse in the book that he could to drive a wedge between him and the female lead which started with the Shen family Since loved his nephew and his own twisted way he couldn’t bring himself to punish him so he punished the female lead and the people around her instead.
As for her, not buying down into the fake astrologer, it’s like the Emperor said he was just using the astrologer to calm the people with the drought and the minute that she couldn’t do it he was gonna have her killed to appease the rage. The female lead interfered with that by not going along with the scam since she knew it was fake so he came up with another reason to punish her for that too. Also, it was another way for him to drive wedge between her and the male because by having her enter the palace to serve the emperor as an astrologer she would’ve had to pretty much remained a nun lol.
He was doing whatever he could in his power to destroy her family and the more she tried to get help or I guess, or to meet his demands the more enraged he became because he basically wanted to destroy her and her family to appoint that they could never come back without killing them. Especially because they had the love of the people so by killing them it would’ve made her a martyr and people might have risen up against him.
But he was so lost in his suspicious and paranoid state that he didn’t realize that his behaviour and actions was literally driving everyone away from him. The elder son hated him to the point where he plotted against him. the Young 6th Prince was so afraid of him that he’d rather live outside the palace, then live in the palace with him, which I didn’t blame him because when he was super young, he basically offended the Emperor once because he was so afraid of him that couldn’t speak and that was ALL it took for the Emperor to decide to send him to the cold palace, where he did not even have a concubine to love him, other then only having monks to meet his basic needs and no one to teach him how he needed to act or behave he was neglected and Abused. He was so obsessed with holding onto his nephew that he ended up, driving him away too by trying to drive a wedge between him and the female lead. Then later on even his other middle side was betraying him because he hated him.