After a blowout performance last year, Palantir (PLTR -2.46%) is delivering an impressive encore this year.
Shares of the deep data analytics company were up 109% year to date as of market close July 28, making it the top-performing stock on the S&P 500. For over a year, there's been concern that Palantir's valuation has gotten stretched, but that hasn't stopped the stock from continuing to soar this year.
After the surge over the past year, Palantir is more expensive than ever before, and it now trades at a price-to-sales ratio of 126, a sky-high valuation that's far ahead of any other stock in the S&P 500. The second-highest P/S ratio in the index is for Texas Pacific Land at 31. In other words, Palantir stock could fall by 75%, and it would still be the most expensive stock on the S&P 500 on a P/S basis.
As a result of that surge, the stock is now one of the 20 most valuable companies in the country, a new milestone for one of the biggest winners in the artificial intelligence (AI) boom. Investors are preparing for Palantir's next quarterly report Monday after the market closes, and many may be wondering: Is it too late to buy the stock? Let's take a look at what's driving the boom in Palantir stock before delving into the question of whether the stock is a buy.

Image source: Getty Images.
How Palantir got here
Palantir stock has soared over the last two years, primarily due to the success of its Artificial Intelligence Platform, which has driven accelerating revenue growth and expanding margins, and demonstrated that the company's analytics platform is in a class of its own. According to Palantir, the company is typically competing with homegrown solutions when it pitches to potential customers, a sign it doesn't have real direct competition.
In the first quarter, revenue jumped 39% to $884 million, and it reported adjusted income from operations of $391 million.
Palantir's revenue growth has now accelerated for seven quarters in a row, and its operating margin has soared along with it, going from a loss two years ago to nearly 20% on a generally accepted accounting principles (GAAP) basis.
However, it's not just numbers supporting Palantir's surge, the company is also benefiting from a perceived windfall from the government under the Trump administration as Palantir is a key defense contractor, and it's been embraced by the current White House.
President Donald Trump signed an executive order in March calling for agencies to share data with each other, using Palantir. There are also reports that Immigration and Customs Enforcement (ICE) is paying Palantir $30 million to build an "ImmigrationOS" surveillance platform to help the agency track self-deportation and information on people who have overstayed their visas.
With the government likely to continue shoveling money at Palantir, the contractor should continue to post strong growth.
Is Palantir a buy?
There's a lot to like about Palantir's recent results and its embrace by the federal government, but the stock's valuation does seem to have gotten disconnected from reality, given a P/S valuation that's now well into the triple digits.
With a P/S ratio of 126, Palantir would have a triple-digit P/E ratio even if its profit margin were 100%. Its 39% revenue growth is a strong clip, but it would take two years for revenue to double and about four for it to quadruple at that rate.
On the other hand, Palantir is now clearly priced for perfection, meaning if the company comes up short on its earnings report, the stock could plunge, and the more inflated the valuation gets, the more likely it is to crash.
At its current valuation, the stock could fall by 50%, and it would still be very expensive. Palantir shares could continue to rise, but at some point, the stock is going to have to grow into its valuation, which will put the brakes on its growth.
At this point, the risk/reward doesn't favor buying the stock.