Can you have yourself admitted as voluntary to a psychiatric hospital to avoid your spouse having you involuntary admitted from court order?

If you feel it is necessary then yes, you may admit yourself to a psychiatric hospital at any time you wish. Should you choose to admit yourself then you will also be able to decide when you are prepared to leave where as with a court order the court decides when you can leave.