As long-term investors, we can't be focused on short-term trends that can cause a stock to get caught up in a hype cycle. However, there are some companies involved in these interest waves that are also attractive investments. The key is to understand if the stock is too expensive to make a good return on.

The latest hype cycle is undoubtedly artificial intelligence (AI), and Palantir (PLTR 1.95%) has gotten caught up in its rise. Up about 80% since its first-quarter earnings report on May 8, AI investors have quickly bid this stock up. While that's an incredible short-term move, has it made the stock too expensive for long-term investors? Let's look at where Palantir might be in five years and decide if the stock is still worth purchasing now.

Palantir has a two-part strategy to grow its business

Part of the reason for Palantir's rise is that it has been using AI from the start of the company. Palantir's data processing product allows its users to input mass data into the system. Then, custom-built AI determines what is happening. Finally, the software provides users insights on what they should do through an easy-to-understand dashboard. This has widespread applications, from the government to supply chains, and can be utilized almost anywhere.

However, the problem with Palantir's software is that it isn't cheap. A one-month subscription to Palantir Foundry (its flagship product) costs $100,000 per month on the Amazon Web Services marketplace, with additional units costing $50,000 per seat (each additional seat allows another user to use the product at the same time). That's a prohibitive cost for many companies and reserves Palantir's products for only the biggest clients.

So this factor will likely limit Palantir's reach and is a topic to keep in mind when assessing its five-year projections. However, with only 280 total customers using Palantir, it hasn't even scratched the surface of signing on customers with the pocketbooks to use the platform.

Furthermore, most of Palantir's business comes from government sources (55% in Q1), so it will remain a key client in the company's future.

The key to Palantir's future is maintaining and expanding its government contracts while signing on more civilian customers. With government revenue rising 20% year over year (faster than its total revenue growth) and commercial customer count rising 41% in Q1, Palantir is doing precisely what it needs to do to succeed.

But has the stock gotten too expensive?

The stock isn't too expensive

Thanks to its recent run-up, Palantir's stock valuation has gone from fairly valued to expensive in nearly two months.

PLTR PS Ratio Chart

PLTR PS Ratio data by YCharts

At the end of the day, investors care about profits, not sales. While Palantir hasn't had a full year of profitability, it delivered $0.01 in earnings per share over the past two quarters. Additionally, management increased its guidance that Palantir will be profitable every quarter in 2023.

This is a great trend and takes some of the guesswork out of the stock analysis if Palantir is able to be profitable in five years.

Palantir is a young and growing software company, so a revenue growth rate of 15% over the next five years isn't a far-fetched idea. If that rate holds, Palantir's revenue will double to around $4 billion in 2028. As a company scales up, it doesn't have to spend as much proportionally on its expenses, which improves profitability.

In Q1, Palantir's operating expenses only rose 6% compared to revenue growth of 18%. If this figure is sustainable, Palantir's operating expenses will only total $2.2 billion in 2028.

That would mean Palantir would have an operating profit of $1.8 billion. If you reduce that figure by 20% to account for taxes and other costs, that would leave $1.44 billion in profits for investors.

By dividing Palantir's market cap by its hypothetical profits five years in the future, we get that Palantir's stock is trading at 20 times future earnings.

Investors would usually expect to pay a price of 20 times earnings for a mature company, so does that make Palantir a decent buy? I think so. The key is its high-margin subscription software business. A mature software company like Adobe has traded around 50 times earnings over the past seven years. So in all reality, a valuation of 40 to 50 times earnings should be expected if Palantir executes like is projected above, indicating a 100% to 150% stock rise from today's levels.

Despite its run-up, Palantir can still deliver market-crushing returns over the next five years. But you'll have to be patient and wait for them to happen. I think Palantir is still a strong buy here, and investors can confidently take a position in the stock if they come in with the mindset of owning it for at least five years.