It has been quite the roller-coaster ride for Palantir (PLTR) shareholders in the past few years. After going public in 2021, the stock experienced an 80% drawdown in the 2022 bear market. Since then, it has clawed its way back with a vengeance. Shares have risen close to 500% in the past three years, making Palantir one of the best-performing stocks in the market.

Why? Two words: artificial intelligence (AI). Palantir is a software and services provider of AI tools to the government, military, and big business. Everyone loves AI stocks right now, and it's seeing increasing adoption and contract wins that are driving the stock higher. But are investors who buy in 2025 too late to the party? Let's dive into Palantir stock and see if it's a buy for your portfolio this calendar year.

AI for national security (and businesses)

Palantir's software uses AI and other analytical tools to help large organizations garner insights from their data. Its custom solutions are catered to organizational needs. For example, it has contracts with the U.S. military, CIA, and other government agencies. Last quarter alone, U.S. government revenue was $320 million and growing 40% year over year.

It looks like this growth is set to continue as the company is signing huge contracts with the U.S. government. One example is a recent $618 million deal with the U.S. Army for a period of up to four years. The U.S. government -- one of the largest organizations in the world -- has a sprawling set of data sources that can be challenging to manage. This is what the U.S. government is dealing with, and why it's willing to pay Palantir a pretty penny to organize and analyze it.

To expand its addressable market, Palantir has shifted its focus to selling its AI tools to large enterprises as well. Using the government's confidence in Palantir as a selling point, management has made inroads selling its services to large companies. U.S. commercial revenue was Palantir's fastest-growing segment last quarter, up 54% year over year to $179 million.

Large growth prospects and room for profit margin expansion

With less than $200 million in quarterly revenue from its U.S. commercial segment, Palantir has a long runway of growth in this market. Last quarter alone, it closed 104 deals worth over $1 million and grew its customer count 39% year over year. Software and analytical tools are sticky and usually see growing spend from customers over time. As Palantir wins new customers, its growth should accelerate and help consolidated revenue march higher over the next five years.

On the profitability front, Palantir has a lot of room for improvement. Over the last 12 months, its operating margin was only 13%. To be fair, this is a big improvement from years past and is low due to Palantir's reinvestment for growth, but it's still lower than most software businesses. With a gross margin consistently above 75%, I expect Palantir's operating margin to expand past 20% and eventually 30% in the next five years. This will help its bottom-line profits soar once this business starts maturing.

PLTR Revenue (TTM) Chart

Data by YCharts.

Is it too late to buy Palantir stock?

Thanks to its recent gains, Palantir sports a market cap of $180 billion, making it one of the 100 largest companies in the world. It's shocking when you fully consider how a software company with just $2.6 billion in trailing-12-month revenue is one of the biggest companies on earth, at least by market capitalization. Like its share price, its price-to-sales ratio has soared to 72, making it the most expense stock in the S&P 500 by that metric. 

That's why it's indeed too late to buy Palantir stock in 2025. If the company grows its revenue 40% annually over the next five years, its revenue will hit $15 billion in 2029. Assuming its net income margin can expand to 30% by that time, the company would generate $4.5 billion in annual earnings. This is a very optimistic scenario, one I think is unlikely to even occur (though that doesn't mean Palantir won't grow earnings over the next five years).

But even based on this bullish outlook for earnings of $4.2 billion versus its current market cap of $180 billion, Palantir trades at a forward price-to-earnings (P/E) ratio of 40. Put simply, even if Palantir puts up 40% annual growth through 2029 and expands its profit to 30%, it will still trade at a steep premium to the broad market. Expectations are sky high for the stock, and price matters when investing. The hype around Palantir is just too much, and investors should stay away, at least for now.