Rising COVID-19 cases. Concerns about the highly contagious delta variant. The possibility of another housing bubble bursting. These are some of the reasons why worries are increasing among investors that a stock market crash could be on the way.

One of the biggest stock market bears, Harry Dent Jr., who predicted the dot.com bubble collapsing, even thinks that a market meltdown is likely within the next three months. Is all of the pessimism warranted? Maybe, maybe not.

If you're leery about what's around the corner, here are three stocks to buy if a market crash is coming soon. And the great news about these stocks is that they're solid picks even if it doesn't happen.

A person looking at a large display of stock charts trending down with arrows pointing down.

Image source: Getty Images.

BioNTech

I personally don't think a stock market crash is just around the corner. If one is, though, I suspect the cause will be the combination of the COVID-19 pandemic and sky-high market valuations. Assuming I'm right, BioNTech (BNTX 1.63%) should soar if the market crashes.

A massive market sell-off due to COVID-19 worries would almost certainly light a fire beneath the stocks of the leading vaccine makers. My view is that BioNTech would be one of the biggest winners in the group.

BioNTech and its partner Pfizer (PFE 0.19%) are already moving forward with plans to test a vaccine that specifically targets the delta variant. That gives the companies a head start. BioNTech is by far the smallest of the companies with COVID-19 vaccines already on the market, which makes its shares more likely to jump higher on a positive catalyst. It's also easily the cheapest of these vaccine stocks, based on forward earnings multiples.

What if there isn't an imminent market crash? BioNTech is still set to rake in billions of dollars with sales of its COVID-19 vaccine. The company will almost certainly use its growing cash stockpile to invest in expanding its pipeline. I think that BioNTech will be a winner over the long term, regardless of what happens over the short term.

Dollar General

I've maintained for a long time that Dollar General (DG -2.09%) is one of the best stocks to own during a market downturn. That view seemed to be confirmed during the big market meltdown last year.

DG Chart

DG data by YCharts.

Shares of Dollar General fell at first, but not nearly as much as most stocks did. Dollar General stock also rebounded much more quickly and trounced the overall market's return throughout the rest of the year.

During uncertain times, consumers tighten their purse strings. That makes discount retailers such as Dollar General more attractive than ever. 

Even when the overall market performs well, though, Dollar General should still be able to grow. As a case in point, the company's shares delivered more than double the gain that the S&P 500 index did in the five years leading up to 2020 when the market was roaring.

I think that Dollar General will be able to continue to beat the market. It's moving forward with an aggressive expansion strategy. The company is also undertaking a major initiative to "establish itself as a health destination." While Dollar General didn't provide many details on exactly what its plans are, moving more into healthcare sounds like a smart move to me.

Viatris

There are at least two reasons why a given stock might hold up well during a big market sell-off. One is that its underlying business isn't impacted much by the reason behind the broader plunge. Another is that the stock is so cheap that investors scoop up shares if it falls much below its existing price. My take is that Viatris (VTRS -0.09%) qualifies on both of these criteria.

Viatris specializes in biosimilars and generic drugs. Patients need these drugs, regardless of what the stock market does. The drugs are also less expensive than branded prescription drugs.

The stock is irrefutably dirt cheap. Viatris' shares trade at a little over four times expected earnings. It's unlikely that the stock is going to move much lower because it would simply be too much of a steal for investors to ignore.

Granted, Viatris probably won't keep up with the overall stock market's performance if the current uptrend continues. However, the company's dividend is attractive. And over the next several years, Viatris should achieve synergies resulting from the merger of Pfizer's Upjohn unit and Mylan, as well as launch new products that should drive growth.