A 401(k) loan does not count when calculating your debt-to-income ratio or credit score, hence it won’t affect your chances of qualifying for a mortgage loan. You can take a 401(k) loan to pay down payment for your home.
However, the mortgage lender may require you to disclose your current monthly obligations, including 401(k) loans, when applying for a mortgage.