After a disastrous performance in 2022 (the worst in the past decade), the stock market has so far made a solid recovery in 2023. The benchmark S&P 500 index is currently up by 27.4% from its bear market low in October 2022 and only 5% below its all-time high reached in January 2022. A bull market has not officially begun just yet (it requires a 20% increase from the bear market low and setting a new all-time high), but the current trading environment hints at one looming right around the corner.

Some of this year's market performance can be attributed to investor enthusiasm for anything related to artificial intelligence (AI), which is fueling a technological revolution thanks to recent advancements. As a potential bull market inches closer to reality, investors looking for stocks that can take advantage of the coming bull as well as AI have lots of choices. Let's look at an AI stock to buy and one to avoid.

Strength in cloud computing and AI will drive up Microsoft's share prices

Technology titan Microsoft's (MSFT 1.82%) name is synonymous with computing. Known best for its ubiquitous Windows operating system and Office productivity suite, Microsoft is now establishing itself as a force in the generative AI and cloud computing markets.

Microsoft's $13 billion investment in ChatGPT creator OpenAI has been a game-changer. OpenAI is helping Microsoft integrate the latest AI technologies into its core offerings, such as Azure Cloud, Bing Search, Office 365, and Github.

The recent upheaval at OpenAI involving CEO Sam Altman, who was ousted by OpenAI's board of directors only to be reinstated a week later by a largely new board, could prove to be a positive for Microsoft. The resolution of OpenAI's turmoil should make it stronger from an innovation and governance perspective. Microsoft may also see a stronger relationship with OpenAI (including a seat on the board) because it supported Sam Altman during the chaos.

Microsoft's cloud computing business is its biggest growth driver right now. Fiscal 2024 (ended Sept. 30, 2023) first-quarter revenue from its Intelligent Cloud segment was $24.3 billion, up 19% year over year. The growth was driven mainly by a 29% year-over-year jump in Azure sales. Azure benefits from a trend toward cloud spending optimization. Microsoft's prowess in generative AI technology is also helping attract new customers to its cloud business.

Microsoft is adding new revenue streams by monetizing AI-powered assistants, such as Microsoft 365 Copilot and GitHub Copilot. The company has also unveiled two new chips for AI and enterprise workloads, which will help reduce the company's dependence on external semiconductor players.

With a $22.3 billion profit in the first quarter, a solid balance sheet with $144 billion in cash, a strong cloud computing business, and AI-driven growth initiatives, Microsoft makes for an attractive investment choice.

C3.ai top-line growth slows, delaying potential profitability

Not all companies in the AI space are poised for equal success. Prudent investors would be wise to avoid slow-growing and unprofitable AI companies that face tough competition from cash-rich technology titans. One such company is C3.ai (AI 3.02%). Business-oriented AI expert C3.ai first caught investors' attention around the time OpenAI released its consumer-friendly chatbot ChatGPT and sparked the AI frenzy.

Instead of offering a one-size-fits-all AI option for businesses, the company's hyperspecialized cloud-native AI tools help enterprise clients generate reports and derive actionable insights, all customized for specific sectors. Clients can customize the tools to integrate with existing analytic tools. C3.ai's recently launched C3 Generative AI product suite aims to transform enterprise search by allowing clients to locate and retrieve resources across their entire information systems through simple chatbot requests.

C3.ai comes across as a potential AI-related investment option, but there are several downsides to this stock. The company's top-line growth is underwhelming. In the first quarter of fiscal 2024 (ended July 31, 2023), revenue rose just 11% year over year. The company also reported a generally accepted accounting principles (GAAP) loss per share of $0.56 in the first quarter (although it was an improvement over the $0.67 loss per share in fiscal 2023's Q1). Management had previously predicted C3.ai would be non-GAAP profitable by the end of fiscal 2024 (April 30, 2024) but now expects to reach this target by the end of fiscal 2025.

C3.ai claims to have no significant competition, but that could change as Microsoft and Alphabet are increasingly focused on expanding their presence in the cloud-based AI services space. The implementation of large language models in generative AI applications is a resource-intensive operation. This may prove challenging for a company with just $751 million in available cash on its balance sheet. The company used up $141 million of its available cash in the past four quarters and may need more funds if it wants to accelerate its AI plans. That could lead to issuing more stock or reducing the pace of investments and neither option is likely to excite investors.

Even with all these potential negatives, the enthusiasm for AI has C3.ai stock trading at a lofty price-to-sales multiple of 11.8, far more than the software industry median multiple of 2.2 times.

Considering all these challenges, it is best to avoid the stock now.