If you’re in a community property state and you want to leave your spouse off the mortgage, you can do that. However, if you’re applying for an FHA or VA loan, the lender will have to consider your spouse’s debts when you apply for the loan.
https://www.rocketmortgage.com/learn/buying-a-house-without-your-spouse
I think conventional loan is okay to leave spouse without considering the spousal debt.