After a powerful run earlier in the year, the tech-heavy Nasdaq Composite (^IXIC +0.88%) has slipped from recent highs as investors reassess how much they are willing to pay for artificial intelligence (AI) beneficiaries. Spooked, some investors are seemingly rotating out of some of the most aggressive AI winners.
That nervousness is understandable. AI infrastructure spending has surged, and many AI-linked stocks have multiplied in value. Yet the current sell-off is also revealing a gap between truly attractive AI investments and those that may be overhyped.
For investors trying to sort opportunity from risk, Microsoft (MSFT 1.48%) and Palantir Technologies (PLTR 0.62%) illustrate that range. Microsoft looks like a credible way to lean into long-term AI demand during volatility, while Palantir will likely be far more exposed if AI spending or sentiment cools.
Image source: Getty Images.
One AI stock to buy
Microsoft arguably sits at the center of the AI buildout. Benefiting from AI (and powering it) is the software giant's Azure cloud computing platform. Of course, the company is also using generative AI with its Copilot assistant across its productivity tools in Microsoft 365. Then there's its partnership with OpenAI.
Importantly, AI is already positively impacting the software giant's financial results, too. In Microsoft's first quarter of fiscal 2026, the company generated revenue of $77.7 billion, up 18% year over year. Microsoft Cloud revenue grew 26% year over year to $49.1 billion in the same period.

NASDAQ: MSFT
Key Data Points
Revenue from its intelligent cloud segment climbed 28% year over year to $30.9 billion, aided by 40% growth in "Azure and other cloud services revenue."
The stock does not look cheap, but it is not euphoric either. Microsoft stock has a price-to-earnings ratio of 34 -- a premium to the broader market, yet one supported by high-teens revenue growth, rising earnings per share, and a balance sheet stacked with cash.
In my opinion, Microsoft stock is worth buying and holding for the long haul. It gives investors exposure to the AI boom without paying bubble-like prices.
One AI stock to avoid
Data analytics and software company Palantir has become one of the market's loudest AI beneficiaries, with its stock up more than 100% this year (even after a big pullback in recent weeks).
Investors love Palantir's growth. Third-quarter revenue rose 63% year over year to about $1.2 billion. This was a huge acceleration from 48% growth in the prior quarter.
Profitability looks good, too. The tech company reported a third-quarter generally accepted accounting principles (GAAP) profit of $476 million, or 40% of revenue.

NASDAQ: PLTR
Key Data Points
Yet the stock's valuation leaves very little margin for disappointment. As of this writing, shares trade at about 165 times forward earnings. This is a bubble-like valuation.
Sure, this valuation level might be defensible in a world of limited competition and near-certain sustained hypergrowth. But reality looks less comfortable. Palantir faces well-funded rivals in analytics and AI platforms. Additionally, its heavy reliance on government contracts makes it susceptible to government spending shifts. With the stock already priced for exceptional results, any cooling in AI enthusiasm or slowdown in contract wins could ultimately hit the shares much harder than the underlying business, making this a risky place to hide during AI bubble scares.
Which is the better buy?
AI bubble worries have reminded investors that even promising technologies can produce painful stock-price swings. This raises the stakes for making sure you're invested in the best options.
For those who want exposure to the theme without taking on undue valuation risk, Microsoft looks like the more resilient option, thanks to its diversified business and far more conservative valuation.
Palantir, by contrast, simply prices in too much. Even more, the company's business isn't nearly as diversified as Microsoft's.
While it's impossible to know for sure which stock is the better long-term buy, one thing is clear: Palantir stock looks a lot riskier today than Microsoft does. For that reason, I'd personally avoid Palantir, and I'd consider buying shares of Microsoft to get more exposure to the AI boom.