Got $5,000 to spare for a few five-year, set-it-and-forget-it allocations? Regardless of 2022's trials and tribulations, the next half-decade could belong to the tech sector -- and in particular, one niche segment that has been in the headlines a lot lately: artificial intelligence (AI).

It's practically a guarantee that you have come into contact with some form of machine learning or artificial intelligence recently. They increasingly inform how we interact with gadgets and businesses, and how we accomplish tasks at work and at home.

And they're bound to grow whether we're ready for it or not. So consider an easy strategy to prepare for the rise of the machines in the next five years and beyond.

a person looking at a laptop with a digital representation of AI in the background

Image source: Getty Images.

Resistance is futile

It's understandable if some investors might attach negative connotations to machine learning. The thought of bots replacing humans across multiple industries is, admittedly, somewhat unpalatable.

Yet the ascendance of this form of automation is inevitable. It's backed by the White House and the European Commission, which recently agreed to accelerate and enhance the use of AI to improve "agriculture, healthcare, emergency response, climate forecasting and the electric grid," Reuters reported.

Meanwhile, Fortune Business Insights expects the global AI market to reach nearly $1.4 trillion in 2029, growing at a compound annual rate of 20.1% from 2022 through 2029. The demand for AI technology is anticipated to impact the retail, automotive, healthcare, logistics, and food and beverage industries, among others.

So investors can either board the automation train or be left behind. Perhaps you have already heard about OpenAI's ChatGPT platform, which has been in the news recently? But OpenAI isn't listed on a major stock exchange. There are other AI-infused businesses that are listed, however, and deserve a slice of this hypothetical $5,000 pie.

Invest in OpenAI indirectly

A great place to start with a $5,000 investment in machine-learning is to buy $2,000 worth of Microsoft (MSFT 1.82%) stock. Although it is involved in much more than AI, the company has introduced its Azure OpenAI Service, thereby allowing more businesses to access OpenAI's ChatGPT chatbot and Dall-E 2 image generator.

CEO Satya Nadella said recently, "The age of AI is upon us, and Microsoft is powering it." Microsoft is reportedly discussing investing as much as $10 billion into OpenAI. 

So as Microsoft moves toward a frontline position in early machine-learning adoption, it makes sense to allocate a fair share of $5,000 toward its stock.

Something old and something new

Next, investors can take another $1,000 and put it into International Business Machines (IBM -1.05%). It might seem counterintuitive to invest in machine learning through a dinosaur like IBM, but sometimes old pioneers can get a second act in growing markets.

IBM's Watson supercomputer beat Jeopardy! champions in 2011. CEO Arvind Krishna said in a conference call that the U.S. Patent and Trademark Office and the British Broadcasting Corporation are deploying IBM's AI tools. Given the company's favorable long-standing association with machine learning, it's not a bad idea to put one-fifth of a $5,000 AI stake into IBM.

As for the remaining $2,000, investors might pick a company with AI in its name: C3.ai (AI 3.02%). Unlike Microsoft and IBM, C3.ai is a pure play in the machine-learning space. This, along with the stock's relatively low price, will make it more volatile.

Nevertheless, C3.ai seems worth a $2,000 allocation. The company has a variety of clients in the public and private sectors, including Fortune 500 companies. The U.S. Air Force has implemented C3 AI Readiness, which the company calls an "AI-based solution to effectively predict subsystem failure, identify necessary spare parts, and proactively highlight opportunities to increase mission capability."

And C3.ai just announced a new suite of tools, collectively known as C3 Generative AI, which CEO Thomas Siebel says "fundamentally changes the human computer interaction model of enterprise application software," and that it will "change everything about enterprise computing." 

That remains to be seen, but if this new product suite can help C3.ai maintain its current big-ticket clients and entice new ones, the company should be able to hold its own against bigger competitors like Microsoft, Alphabet, and others.