Bill Gates, the co-founder and ex-CEO of Microsoft (MSFT 0.11%), has amassed a net worth of nearly $130 billion, per Forbes. Of this, the Bill and Melinda Gates (BMG) Foundation Trust manages a $42 billion investment portfolio. Interestingly, 67% of this portfolio is concentrated in only three stocks -- highlighting Gates' confidence in these picks.

With Gates having access to top-notch financial advice and extensive research capabilities, it makes sense for retail investors to learn about his investment choices. Here's why the top three stocks (by dollar value) in his portfolio can be smart picks for retail investors.

1. Microsoft: 34%

Microsoft is the biggest holding in Gates' investment portfolio. While previously known mostly for its Windows operating system and Office productivity suite (under Gates' leadership), Microsoft is now more famous for its Azure cloud computing platform and generative artificial intelligence (AI) endeavors. Microsoft's partnership with ChatGPT developer OpenAI is also pivotal in the growth of its various businesses.

Microsoft's fiscal 2024 third-quarter results (for the period ended March 31) were impressive, with the company surpassing revenue and earnings consensus estimates. The Cloud business (which includes multiple cloud-based products such as Azure, Microsoft 365, Dynamics 365, Microsoft Security, and industry solutions) is the major growth driver for the company. Microsoft Cloud revenue was up 23% year over year to $35.1 billion in the third quarter.

Enterprises are increasingly preferring Azure to migrate on-premises workloads to the cloud environment. Azure's integration with various software applications, database and analytics services, and OpenAI services has also played a pivotal role in the rapid expansion of its customer base and an increase in per-customer utilization.

Azure OpenAI service is currently used by over 65% of Fortune 500 companies. Additionally, the number of large Azure deals increased in the third quarter, with $100 million-plus deals growing 80% year over year and $10 million-plus deals more than doubling in the third quarter.

Dynamics 365, a cloud-based suite of enterprise solutions, saw a solid 22% year-over-year revenue growth in the third quarter. The increasing shift from perpetual licensing to subscriptions is also driving growth for the Microsoft 365 productivity suite. In addition, the personal computing business has also returned to moderate growth after a few quarters of significant slowdown.

Hence, considering Microsoft's impressive financial results, robust cloud computing and AI businesses, and stable non-AI businesses, the company's stock seems well-positioned to post solid performance in the coming quarters.

2. Berkshire Hathaway: 16.8%

Warren Buffett's holding company Berkshire Hathaway (BRK.A 1.57%) (BRK.B 1.42%) is the second-most prominent stake in Gates' portfolio. The company operates an investment fund worth over $370 billion and owns multiple high-quality operating businesses across manufacturing, insurance, transportation, energy, retail, and services. The diversified business model has made the company resistant to economic uncertainties, including slowdowns and high inflation.

Historically, the insurance segment has been a major growth catalyst for the company -- a trend that has continued in the first quarter of fiscal 2024 (ended March 31), thanks to rising premiums and the absence of catastrophic losses. The company's success in underwriting and using the insurance float (difference between insurance premiums collected and claims paid) for acquisitions and investments continues to play a major role in its growth. Plus, the company has been developing innovative insurance products to capitalize on opportunities in niche markets, thereby diversifying its risk profile and revenue base.

Berkshire Hathaway has been generating tons of free cash flow in the past decade thanks to retained earnings from its operating companies and dividend income from the investment portfolio. The company has sold nearly 13% of its stake in Apple stock and has exited its position in Paramount Global -- pushing up Berkshire's cash and short-term investments to a record $189 billion at the end of the first quarter, up from $167.6 billion at the end of 2023.

Recent results have been impressive, with operating earnings soaring a healthy 39% year over year to $11.2 billion in the first quarter. With the company gearing up for new and potentially less conservative management under Greg Abel, this cash may get deployed in lucrative international ventures.

Although not a high-growth stock, Berkshire's solid fundamentals and strategic management make it a prudent choice now.

3. Canadian National Railway: 16.3%

Canadian National Railway (CNI 2.63%) along with Microsoft and Berkshire Hathaway, accounts for 67% of Gates' $42 billion portfolio. With a network covering 18,800 miles across Canada and the U.S., the company helps transport 300 million tons of cargo annually.

Canadian National Railway operates alongside the Canadian Pacific Railway and acts as a duopoly in the Canadian market. This has further allowed the company to enjoy pricing power, even amid a difficult economic environment.

Being the only railroad player connecting Canada's Eastern and Western coasts with the U.S. South (three-coast network ), the Canadian National Railway enjoys a wide economic moat. Furthermore, the acquisition of the $78 million stake in the Cape Breton & Central Nova Scotia Railway (CBNS) is expected to open up opportunities for the company to strengthen its rail network on the eastern coast.

Since railroads are a capital-intensive industry and involve significant regulatory oversight, the barriers to entry are exceptionally high, which means that the Canadian National Railway can continue to be a force to reckon with for several more years. Railroads are also preferred over trucks for long-distance freight transportation, thanks to better cost efficiency, higher fuel efficiency, and lower environmental impact.

Canadian National Railway is not a high-growth stock. However, the company is committed to returning value to shareholders as dividends and share repurchases. The company has announced an increase in its dividend by 7% in 2024, marking its 28th consecutive year of dividend rise since going public in 1995. Management has also approved a share buyback program to purchase up to 32 million shares until Jan. 31, 2025.

Considering its resilient business model, wide moat, and focus on returning shareholder value, retail investors should also consider picking at least a small stake in this value stock.