In most cases, the husband and wife's loan in the bank is a kind of debt, and the man's gambling behavior will not affect this fact. This is because in the case that both husband and wife have the same loan, no matter who spends the money, both parties need to bear the repayment responsibility. If the man fails to repay the money on time, the bank can recover the arrears from two people, no matter how the money is spent.
However, if you think that the man's gambling behavior has had a significant impact on the couple's loan, such as causing the bank to refuse to provide loans or raise interest rates, you can consider taking legal action. You may need to consult a professional lawyer for more specific advice.