If you're strong enough to physically overpower him without putting yourself in unreasonable danger, you should. If that's not possible, drawing a gun and ordering him to stand down is reasonable. If he continues to attempt the rape (or attempts to rush you), shooting him is then likely the minimum force necessary to prevent a violent crime.
Property crimes are variable, but to prevent violent crime I'm pretty sure that "minimum reasonable force" is legal in every state. Some states allow you to escalate your use of force faster than this, but I'm not aware of any that would require you to stand aside while a rape is in progress.