Software company Palantir Technologies (PLTR 3.73%) and chip company Nvidia (NVDA 6.18%) are two of the hottest stocks on Wall Street. Both stocks are up over 240% over the past year and have fierce loyalty among investors.

Is one artificial intelligence (AI) stock better than the other? To find out, I compared them head-to-head to see why they're thriving and whether they can continue. It was a very close race, but one stood out just ahead of the other.

Here is what you need to know.

Meeting these two very different companies

Both stocks soared due to the fantastic performance of their underlying businesses. However, these two AI companies are very different. Nvidia spent years specializing in high-performance GPUs, which became ideal for data centers and AI. Nvidia's high-quality products and CUDA software, which helps customers efficiently use their GPUs power, have led to Nvidia grabbing an early stranglehold on the AI chip market -- an estimated 80% to 90%.

On the other hand, Palantir builds custom software applications for both government and commercial applications. It runs three software platforms: Gotham, Foundry, and AIP for AI applications. You can think of Palantir as an operating system that helps organizations use their data. The company's intent is that it augments human intelligence; it doesn't replace it.

A closer look at each company's growth

From a pure numbers standpoint, Nvidia is growing leaps and bounds faster than Palantir. You can see below how both companies began accelerating revenue growth in mid-2023, but Nvidia soared on massive data center spending from big technology customers, mainly in the "Magnificent Seven." It could be fair to wonder how long this enormous boost in data center spending from big tech will continue.

One possibility is that these companies start producing custom chips in-house, weaning themselves off of Nvidia's. That could hurt long-term growth for a company currently getting most of its revenue from a small handful of customers.

NVDA Revenue (Quarterly YoY Growth) Chart

NVDA Revenue (Quarterly YoY Growth) data by YCharts.

Speaking of Palantir, the company is not as explosive as Nvidia. But what impresses me is the company's expanding customer base. Palantir's U.S. customer count grew 55% year over year in the fourth quarter and 22% quarter over quarter. Customers come in all shapes and sizes, so it's not a precise translation. Such customer growth bodes well for long-term revenue growth.

Maybe Nvidia's customer concentration won't matter, and Nvidia's chips will maintain their market share. Still, I'd like to see customer expansion like Palantir's.

What's the better bang for your buck?

Analysts expect significant earnings growth from both companies moving forward. On a forward basis, that makes both stocks cheaper than you would guess after both of their 200% runs. I like using the PEG ratio to compare how much I pay for a company's earnings growth. The lower the PEG ratio, the better, and I would like to spend under 1.5 if I can.

Nvidia fits that criteria with a PEG ratio of just over 1. Palantir doesn't quite fit, with its PEG ratio of 1.6.

NVDA PE Ratio (Forward) Chart

NVDA PE Ratio (Forward) data by YCharts

Nvidia is handily the better value today, based on each company's expected long-term earnings growth. Of course, the caveat is whether each company will perform up to expectations.

The verdict is...

Both companies are excellent AI stocks and leaders in their respective areas. Both are accelerating their revenue growth. Naturally, analysts are very optimistic about each company's earnings growth moving forward. Whichever company you believe is more likely to meet growth expectations over the next three to five years is probably your winner.

This Fool is giving Palantir a slight edge. Why?

Palantir gets roughly half its revenue from government contracts. The company's long history with the government could put a bit of a floor into Palantir's business, plus the upside from expanding its customer base. Meanwhile, Nvidia's customer concentration could be problematic if a significant customer opts for another chip.

While the numbers say Nvidia is the better buy, there's an argument that investors can trust Palantir's long-term growth slightly more, especially when looking at the long term.