Artificial intelligence (AI) has become a massive market theme, and investors are looking at ways to cash in on this trend. There are multiple ways to invest in AI, including application, hardware, and data, making it difficult for investors to narrow down how they want to tackle this investment.

Two different ways to invest in AI are through Palantir Technologies (PLTR -2.55%), an application play, and Nvidia (NVDA 1.27%), a hardware company. Both are popular picks in this space, but if I had to choose one, which would it be? Let's find out.

Palantir's platform brings AI to multiple industries

As mentioned above, Palantir is focused on applying AI through its data analytics software. The platform takes in multiple data streams, runs them through its proprietary AI platform, and spits out actionable insights in an easy-to-read dashboard. This platform has applications in multiple fields, including energy efficiency, hospital operations, and stopping money laundering.

Nvidia is a hardware play because training these AI models takes vast computational resources. GPUs (graphics processing units) are the company's primary products and can be used for practically anything computationally intensive, including gaming graphics, training AI models, mining cryptocurrencies, or engineering simulations.

Because Nvidia makes the world's most powerful GPUs, it's a top choice for companies outfitting their data centers to train AI. In fact, 361 of the 500 most powerful computers on Earth use Nvidia components, a testament to its dominance in the field.

However, because Nvidia is exposed to other fields, it isn't an AI pure play, which can be both a benefit and a drawback, depending on how you view it. Right now, it's looking like a drawback.

Nvidia is highly exposed to the PC industry, which crumbled in the past year. Furthermore, the same GPUs used for gaming are also used to mine cryptocurrencies, which is an awful field to sell components to currently. This has wreaked havoc on the company's results, as its gaming segment revenue fell 46% to about $1.8 billion in its 2023 fiscal fourth quarter (ending Jan. 29).

Palantir doesn't see the same weakness, as the demand for its platform has stayed strong, even though enterprise customers haven't been as willing to sign up for expensive software programs due to economic uncertainty. In the fourth quarter, its revenue grew 18% to $509 million, and management gave solid 2023 growth guidance of 16%.

Right now, it's looking like Palantir has the upper hand in its execution, but what about the stocks?

Nvidia's stock is absurdly expensive

Palantir is barely profitable: In the fourth quarter, it posted its first earnings per share (EPS) profit of $0.01 based on generally accepted accounting principles (GAAP). So a valuation metric like price-to-earnings (P/E) is useless in assessing the company's valuation. Likewise, Nvidia is sorting through the lack of demand for gaming GPUs, so its costs aren't optimized, making the P/E ratio bad for it.

However, a price-to-sales ratio makes it easier to understand its historical valuation. Nvidia has been around much longer than Palantir, so there is a larger data set to compare its valuation against. But it doesn't take much investigation to understand why Nvidia's latest price movement is problematic.

NVDA PS Ratio Chart

NVDA PS ratio data by YCharts.

At more than 26 times sales, Nvidia is approaching its peak valuation, last reached in late 2021, right before many tech stocks came crashing down. This is a bad omen for Nvidia, as few stocks can live up to the expectations that come with that high a multiple.

On the other hand, Palantir is valued relatively low for a software company at 9 times sales. This leaves plenty of upside for multiple expansions if the company's growth takes off, but insulates the stock from the downside should the market become hostile to tech stocks again.

Nvidia is an excellent company with a strong AI investment, but it's not a good buy at these prices and in the current market conditions. However, should the valuation revert to an average level (anywhere from 10 to 15 times sales), investors should be willing to pick up some shares -- as long as nothing drastic has changed within the business.

In the meantime, Palantir makes a much better AI investment since it is consistently growing and valued cheaply. Moreover, it hasn't even scratched the surface of its potential customer base, so the company has a long growth runway, making it a great buy now.