It's been a good year for investors in Palantir Technologies (PLTR 6.25%). The defense contractor that focuses on software and artificial intelligence (AI) is up over 100% year to date and now has a market capitalization of $80 billion.

Revenue is accelerating, and the company is starting to generate positive earnings and free cash flow. Investors are getting bullish on the company's push to acquire commercial customers, which are adopting its intelligence software solutions.

And it was recently announced that Palantir will be joining the S&P 500 index later this month. Investors, cheered by the news, sent the stock up more than 10%. Should you buy the stock based on its upcoming inclusion in the index? The answer might surprise you.

Let's investigate whether Palantir belongs in your portfolio today.

Index-inclusion mania

In the last few years, a narrative has formed around index inclusion and stock performance. Many investors believe that -- for reasons such as forced buying by index-focused funds -- a stock is worth more because it is included in the S&P 500. This is why Palantir shares are soaring close to all-time highs at the moment.

To be clear: This is pure nonsense and should only be looked at as speculation. A stock is worth what the underlying business generates in cash flow that is distributed to shareholders (discounted back to today).

Does this have anything to do with what index the stock is listed on? No, of course not. With Palantir, we have an example of a mimetic narrative taking hold: People believe that a stock will go up because other people tell them that index inclusion matters and thus will cause the stock to go up. It's flawed reasoning that has nothing to do with the financial fundamentals of the business.

Being added to an index might cause a stock to go up -- as it has with Palantir. But it tells you nothing about what a stock is worth.

PLTR Revenue (TTM) Chart

PLTR revenue (TTM) data by YCharts; TTM = trailing 12 months.

A thriving business

So, how is Palantir's business doing? Quite well. Total revenue grew 27% year over year to $678 million last quarter, with U.S. commercial revenue growing 55%.

Total customer count has hit 593 and is growing every quarter. Once Palantir lands a customer and starts implementing its software and AI tools, it generally keeps growing revenue with that customer. So as its number of customers keeps growing, revenue should continue to grow as well.

Even better, Palantir is increasing its earnings and cash flow at the same time. Operating income was $292 million in the last 12 months, compared to massive losses when it went public a few years ago. The operating margin has now expanded to 12%. Free cash flow is also healthy at $696 million although the company spends a lot on stock-based compensation.

Overall, the business is thriving and has a long runway to grow, especially if you believe in the tailwind of AI implementation across commercial customers.

The stock is expensive

Today, Palantir sports a market capitalization of $80 billion. Its shares outstanding keep rising, which will be a headwind to returns. Over the last 12 months, the company has generated $2.48 billion in revenue. That is a price-to-sales ratio (P/S) of 34. Not a multiple of earnings, but a multiple of sales.

Let's make some estimates to show why this P/S multiple is so extreme. If Palantir accelerates revenue growth to 30% annually for the next five years, it will hit $9.2 billion in sales five years from now. These are extremely aggressive growth assumptions and would make Palantir one of the largest software businesses in the world.

If the company hits a best-in-class operating margin of 30% in five years, that is about $3 billion in annual earnings versus a current market cap of $80 billion. Or a price-to-earnings ratio (P/E) of 26.6.

A P/E of 26.6 is right around the S&P 500 average. Remember: This is after five straight years of 30% annual revenue growth and profit margins expanding to 30% (a rare feat). And it doesn't include the share dilution that will occur because of Palantir's heavy stock-based compensation packages.

Again, a stock is worth what the company will generate in cash and redistribute to shareholders. Palantir is valued like it will have double-digit revenue growth through the decade and hit best-in-class profit margins soon. These are high expectations that will need to be surpassed in order for the stock to do well over the long term.

No matter how good the business is, these are much too high expectations. Avoid buying Palantir Technologies stock after its 100% rise in 2024.