You can't eliminate the risk, but you can ameliorate it. Yes, sectors like retail, construction, and even healthcare will take a hit during the AI bust. After a crash, there's much less money floating around. People are out of work. Asset prices are down. People spend less. So every sector gets hit.
But there is a difference between a hit and a collapse. If you're invested in OpenAI, and the bubble bursts? Your investment is going to zero. The company is going to go bankrupt. Shareholders will be completely wiped out. If you're invested in say...Home Depot, well yes, in a crash, the stock will go down. With millions laid off, people will have less money to spend on home renovations, so demand for the Depot's products will decline. Their stock price will take a large hit.
But, if you're smart, this won't hurt you. Eventually things will recover, the bubble will clear out, and demand for building products will return. At that point the Home Depot stock price will recover. As long as you don't sell during the crash, you won't see any losses.
That is the key difference. An investment in any sector right now risks a decline and then recovery a few years down the road. An investment in the AI sector risks a complete collapse to zero.