Costco Wholesale (COST 0.56%) has been one of the hottest stocks over the past few years. Up 78% since 2020, it has blown past the S&P 500 and its 36% gains during that stretch. The business has been booming despite a myriad of economic conditions.

But with its growth slowing, is the party finally over for the stock and its bullish investors? Let's take a look.

Analysts are trimming their price targets

Many analysts remain bullish on Costco's stock, but the average price target is just under $549. At that number, it might only rise by less than 5% over the next year, which is how far out analyst estimates normally go. And price targets have been coming down; a year ago, the consensus was around $570.

Analysts have been trimming their price targets, and what little potential upside remaining could soon be gone. A look at its valuation suggests that there could be some strong merit to this forecast.

The stock doesn't look cheap

Costco stock has risen 15% since the start of the year as it continues to be a hot buy. That has pushed an already expensive valuation even higher, with the stock now trading at close to 39 times its trailing earnings. That's well above average compared to the premium that investors have been paying for the stock in the past.

There's a compelling argument that the stock could be overvalued. The S&P 500 averages a price-to-earnings multiple of just 20, so investors are paying a significant premium for the retail stock right now.

COST PE Ratio Chart

COST PE ratio; data by YCharts. PE = price to earnings.

Has the company run out of room to grow?

Another reason the stock might perform poorly over the next 12 months is that the business could be running out of steam. Costco's growth is now the slowest that it has been in the past five years.

The company reports monthly sales numbers, and for May, its comparable-store sales declined 0.3%. In the U.S., they declined by 1.5%. Changes in gasoline prices had a big impact, but even when stripping that out, sales in the U.S. were up just a modest 1.7%.

For investors to continue paying such a high premium for the stock, Costco will likely need to report better growth numbers. Unfortunately, given the current economy and consumers' struggles this year, that could prove to be difficult even for Costco.

COST Revenue (Quarterly YoY Growth) Chart

COST revenue (quarterly YoY growth); data by YCharts. YoY = year over year.

Are analysts right about Costco?

Analyst price targets typically cover the next year or so. And given that context, I would agree that the stock might be due for a decline. But that's only in the short term.

The company's growth is down only because the economy isn't in great shape at the moment. As that changes, growth should return, especially with the company looking at more stores in China. It opened a third location there in March, and more are planned for the current fiscal year.

Holding the stock for the next 12 months could be a bumpy ride. But if you're willing to hang on for multiple years, this can still be an excellent buy despite the seemingly high valuation. The business has proved to be resilient amid inflation and a pandemic. Its operations are still growing, and profitability is likely to continue to improve as well, potentially bringing down its earnings multiple in the process.

Overall, Costco can still be an excellent buy-and-forget investment to tuck away in your portfolio for the long haul.