If Alice accuses Bob of some misconduct (sexual or otherwise) in a statement to a third party, Bob can sue Alice for defamation. He would have to show that the statement is false, and generally speaking that Alice was at least negligent in making that allegation. But if he does show this, he would generally be able to prevail.
If Alice makes the accusation in some context where she is protecting some legitimate interest of her own or of the third party—for instance, the third party is Alice and Bob's employer—then she might be protected by a "qualified privilege." To oversimplify slightly, this basically means that she won't be liable unless she knows the statement is false (or at least likely to be false).
But if Alice makes the statement about Bob in court, then she as a witness is generally absolutely immune from defamation liability. She might still be prosecuted for perjury, if the prosecutor concludes that she deliberately lied. But she needn't fear a lawsuit from Bob. And the same is true in other "quasi-judicial" proceedings.