At first, Beckett could be in shock. She never expected Castle to think such a thing. Then she would gather evidence to clear her name, like showing him the case files she was working on that made her seem'suspicious'. And she would tell Castle that his lack of trust is a big problem in their relationship.
Beckett might try to prove her innocence in a very rational way. She would start by explaining all her recent activities and interactions that Castle might have misinterpreted. She may also feel disappointed in Castle for not having more faith in their relationship.
She is probably angry and frustrated. She would demand Castle to explain why he thinks so and would be hurt that he doesn't trust her.
He might be in denial at first. He could keep trying to convince himself that there's no way Beckett would leave him.
She could be defensive of Beckett. Since Alexis probably has a good relationship with Beckett, she may try to convince Castle that he's wrong and that Beckett didn't mean any harm. For example, she might tell Castle about all the positive things Beckett has done for her.
Alexis might confront Beckett directly. She could say something like 'I think you're cheating on me. What's going on?' This is a very straightforward approach.
He might react with jealousy. He could glare at Josh and then give Beckett a hurt look before storming off.
Maybe he saw Beckett spending a lot of time with another man without knowing it was for a case. Castle is a bit of a jealous type, and he might overreact to normal interactions.
She might confront Harry directly. In the heat of the moment, she could burst out with her suspicions and demand an explanation. For example, she might say, 'Harry, I've noticed you've been acting strange around that girl. Are you cheating on me?'
He could react with anger. After all, if he has feelings for Beckett, seeing her with someone else like Vaughn might make him furious. He might lash out at both Beckett and Vaughn without really understanding the situation.
In a fanfic scenario where Beckett thinks Castle is cheating, she might initially be in denial. But as evidence mounts, she could become angry and start to distance herself from him. This is because trust is a huge part of their relationship, and if she thinks he's violated that trust, it would be a big blow to their connection. Maybe she'd also start to question all the other aspects of their relationship, wondering if things were ever real between them or if she misread him all along.
He might be overjoyed at first. Castle has always been deeply in love with Beckett, and a baby would be like a new adventure for them. He'd probably start making plans right away, thinking about baby names and how to turn one of the rooms in their place into a nursery.
He might cope by writing. Castle is a writer, after all. He could pour all his emotions into a new book, using it as an outlet for his grief. The book could be about their relationship, or a fictionalized version of the events leading up to her 'death'.