Artificial intelligence (AI) is dominating investors' attention this year. The technology has already delivered some impressive practical applications, and it has sent stocks like Nvidia surging. 

But, as is the case with any transformative technology, AI will likely yield the most value for investors over the long term. The estimates for the potential impact of AI are already staggering, even at the low end: Research firm McKinsey & Company predicts it will add $13 trillion to global economic output by 2030, and Cathie Wood's Ark Investment Management puts that number at $200 trillion! 

Looking out even further, AI will likely completely change the way people work, socialize, and access information. Investors can capture the growth of those trends by owning shares in the industry's leaders. With that in mind, I think the following three stocks will be among the most valuable by the year 2050.

1. Microsoft

Microsoft (MSFT -0.69%) is currently the world's second-largest company with a valuation of $2.5 trillion. As a result, this might seem like an obvious pick, but there's no guarantee it will keep its position over the next three decades. United States Steel, for instance, was the world's largest company 122 years ago with a value of $1 billion -- today, it's worth a mere $5 billion. Microsoft will have to maintain its relentless focus on innovation to remain near the front of the pack. 

Microsoft has snatched a leadership position in AI this year seemingly out of nowhere. It made a series of sizable investments in AI start-ups like ChatGPT developer OpenAI, and also Builder.ai, which helps entrepreneurs build software with no programming expertise required. 

Microsoft has plugged ChatGPT into its Bing search engine because it believes prompting a chatbot for answers is a more efficient way to access information, compared to the existing model that requires the user to sift through pages of web results. The company believes it can use this strategy to capture some of the $200 billion advertisers spend each year to reach customers on search engines. 

But the most valuable integrations for ChatGPT and Builder.ai will likely be with Microsoft's cloud computing platform, Azure. This is where the trillions of dollars in new economic output will come from, because the cloud is where businesses are developing AI applications. Azure gives its customers access to OpenAI's latest GPT-4 technology, which is capable of recognizing images, generating media including text and video, and even writing computer code. 

Similarly, Builder.ai on Azure could one day become an onramp to AI-powered software development for even the smallest of businesses that are spending an increasing amount of money on third-party solutions. Previously, building their own software applications was out of reach due to a lack of resources. 

One Wall Street analyst at Bernstein thinks Microsoft's heavy focus on AI could catapult Azure past Amazon Web Services to become the world's largest cloud platform. That will go a long way to cementing Microsoft's staying power in the long term

2. Alphabet (Google)

Alphabet (GOOGL 5.54%) (GOOG 5.30%) is Google's parent company. Its market capitalization of $1.6 trillion places it among the top five most valuable companies today. Google has a 92% market share in the internet search industry, so it's the very platform Microsoft is going after with its ChatGPT-powered Bing. But Google is making progress of its own in AI, and Alphabet has a portfolio of other attractive assets including Google Cloud and YouTube.

Google released a beta version of its chatbot called Bard in March, and it was officially rolled out to the public in 180 countries soon after in May. It's now available in over 40 languages, and its continued development will be key to fending off competitors like Bing. But Google has also made AI-driven changes to its traditional search engine; in many cases, when a user now runs a search, the platform will deliver a text-based answer at the very top of the results to save them having to click through to web pages for the information they seek.

As I touched on earlier, AI development at the enterprise level is going to depend on the cloud. Google Cloud -- while much smaller than Azure and Amazon Web Services -- offers an expanding portfolio of AI and machine-learning applications that businesses can build upon for their own purposes. 

They include language models, customer service solutions, and even new e-commerce tools like Product Discovery, which helps businesses increase conversion rates to capture more of the $2 trillion lost to "search abandonment" each year (when a customer searches a website and can't find what they're looking for). 

Overall, Alphabet is a leader in AI alongside Microsoft. Its staying power as one of the world's largest companies by 2050 hinges on its ability to remain atop the search industry, and the depth it can offer to customers in the cloud space. It's making progress on both counts and until that changes, I'd bet on Alphabet to remain a tech giant long into the future. 

3. C3.ai

Let me be perfectly clear: This next pick is the riskiest of the bunch by a wide margin. C3.ai (AI -0.18%) is valued at just $4.3 billion today and that's after the whopping 236% gain in its stock price this year. While Microsoft and Alphabet grow their revenue consistently and even generate a profit, C3.ai's financials are far more volatile because it's still in the process of scaling its business. 

Nonetheless, this underdog's potential is undeniable. It pioneered a new industry called enterprise AI, which involves the company selling ready-made and customizable AI applications to its 287 business customers. C3.ai's models are so good that even Amazon Web Services, Microsoft Azure, and Google Cloud have partnered with the company to sell them to their cloud customers. 

A business developing an AI application on Amazon Web Services, for example, can accelerate its progress by 26 times by using C3.ai, because it reduces the amount of written code required by 99%. A third-party, independent report determined that experienced development teams could see a productivity boost of 50 to 100 times instead. 

C3.ai currently develops applications for a wide range of industries from financial services to energy, and everything in between. For banks, it offers anti-money laundering software to increase the detection of suspicious activity. For oil and gas companies, it has developed a portfolio of software products that can do everything from reducing carbon emissions to predicting equipment failures to preventing potential environmental catastrophes. 

After operating under a subscription-based revenue model since inception, which creates friction in the onboarding process due to pricing and duration negotiations, C3.ai is now in the middle of a transition to consumption-based pricing. This will lay the groundwork for significant scale because customers will be able to join far more easily and only pay for what they use, which means even the smallest of enterprises will have an opportunity to access C3.ai's tools. 

The company still has a substantial amount of work to do; it continues to lose money, including $268 million in the recent fiscal 2023 (ended April 30) alone, and it will likely require additional capital to fund its mission to scale. As a result, this isn't an investment for the faint of heart -- but if I'm right and C3.ai does become one of the largest companies in the world by 2050, the payoff will be enormous.