Would replacing a leaking roof, which is creating an unhealthy living condition due to black mold, considered an emergency/hardship withdrawal.
No.
For tax year 2024, there is a financial emergency exception, once per calendar year to a maximum of $1,000.
Please read this TurboTax Help article for more information.