One of the best-selling T-shirts for the Indian e-commerce site Myntra is an olive, blue and yellow colorblocked design. It was conceived not by a human but by a computer algorithm — or rather two algorithms.

The first algorithm generated random images that it tried to pass off as clothing. The second had to distinguish between those images and clothes in Myntra’s inventory. Through a long game of one-upmanship, the first algorithm got better at producing images that resembled clothing, and the second got better at determining whether they were like — but not identical to — actual products.

This back and forth, an example of artificial intelligence at work, created designs whose sales are now “growing at 100 percent,” said Ananth Narayanan, the company’s chief executive. “It’s working.”

Clothing design is only the leading edge of the way algorithms are transforming the fashion and retail industries. Companies now routinely use artificial intelligence to decide which clothes to stock and what to recommend to customers.

And fashion, which has long shed blue-collar jobs in the United States, is in turn a leading example of how artificial intelligence is affecting a range of white-collar work as well. That’s especially true of jobs that place a premium on spotting patterns, from picking stocks to diagnosing cancer.

More from The New York Times:

Most Americans see artificial intelligence as a threat to jobs (just not theirs)

Google researchers are learning how machines learn

A.I. has arrived in investing. Humans are still dominating

“A much broader set of tasks will be automated or augmented by machines over the coming years,” Erik Brynjolfsson, an economist at the Massachusetts Institute of Technology, and Tom Mitchell, a Carnegie Mellon computer scientist, wrote in the journal Science last year. They argued that most of the jobs affected would become partly automated rather than disappear altogether.

The fashion industry illustrates how machines can intrude even on workers known more for their creativity than for cold empirical judgments. Among those directly affected will be the buyers and merchandise planners who decide which dresses, tops and pants should populate their stores’ inventory.

A key part of a buyer’s job is to anticipate what customers will want using a well-honed sense of where fashion trends are headed. “Based on the fact that you sold 500 pairs of platform shoes last month, maybe you could sell 1,000 next month,” said Kristina Shiroka, who spent several years as a buyer for the Outnet, an online retailer. “But people might be over it by then, so you cut the buy.”

Merchandise planners then use the buyer’s input to figure out what mix of clothing — say, how many sandals, pumps and flats — will help the company reach its sales goals.

In the small but growing precincts of the industry where high-powered algorithms roam free, however, it is the machine — and not the buyer’s gut — that often anticipates what customers will want.

That’s the case at Stitch Fix, an online styling service that sends customers boxes of clothing whose contents they can keep or return, and maintains detailed profiles of customers to personalize their shipments.

Stitch Fix relies heavily on algorithms to guide its buying decisions — in fact, its business probably could not exist without them. Those algorithms project how many clients will be in a given situation, or “state,” several months into the future (like expanding their wardrobe after, say, starting a new job), and what volume of clothes people tend to buy in each situation. The algorithms also know which styles people with different profiles tend to favor — say, a petite nurse with children who lives in Texas.

Myntra, the Indian online retailer, arms its buyers with algorithms that calculate the probability that an item will sell well based on how clothes with similar attributes — sleeves, colors, fabric — have sold in the past. (The buyers are free to ignore the projection.)

All of this has clouded the future of buyers and merchandise planners, high-status workers whose annual earnings can exceed $100,000.

At more conventional retailers, a team of buyers and support workers is assigned to each type of clothing (like designer, contemporary or casual) or each apparel category, like dresses or tops. Some retailers have separate teams for knit tops and woven tops. A parallel merchandise-planning group could employ nearly as many people.

Buyers say this specialization helps them intuitively understand trends in styles and colors. “You’re so immersed in it, you almost get a feeling,” said Helena Levin, a longtime buyer at retailers like Charlotte Russe and ModCloth.

Ms. Levin cited mint-green dresses, a top seller earlier this decade. “One day it just died,” she said. “It stopped. ‘O.K., everything mint, get out.’ Right after, it looked old. You could feel it.”

But retailers adept at using algorithms and big data tend to employ fewer buyers and assign each a wider range of categories, partly because they rely less on intuition.

At Le Tote, an online rental and retail service for women’s clothing that does hundreds of millions of dollars in business each year, a six-person team handles buying for all branded apparel — dresses, tops, pants, jackets.

Brett Northart, a co-founder, said the company’s algorithms could identify what to add to its stock based on how many customers placed the items on their digital wish lists, along with factors like online ratings and recent purchases.

Bombfell, a box service similar to Stitch Fix catering only to men, relies on a single employee, Nathan Cates, to buy all of its tops and accessories.

The company has built algorithmic tools and a vast repository of data to help Mr. Cates, who said he could more accurately project demand for clothing than a buyer at a traditional operation.

“We know exactly who our customers are,” he said. “We know exactly where they live, what their jobs are, what their sizing is.”

For now, at least, only a human can do parts of his job. Mr. Cates is obsessive about touching the fabric before purchasing an item and almost always tries it on first.

“If this is a light color, are we going to see your nipples?” he explained. (The verdict on a mint T-shirt he donned at the company’s headquarters in New York? “A little nipply.”)

There are other checks on automation. Negotiations with suppliers typically require a human touch. Even if an algorithm can help buyers make decisions more quickly and accurately, there are limits to the number of supplier relationships they can juggle.

Arti Zeighami, who oversees advanced analytics and artificial intelligence for the H & M group, which uses artificial intelligence to guide supply-chain decisions, said the company was “enhancing and empowering” human buyers and planners, not replacing them. But he conceded it was hard to predict the effect on employment in five to 10 years.

Experts say some of these jobs will be automated away. The Bureau of Labor Statistics expects employment of wholesale and retail buyers to contract by 2 percent over a decade, versus a 7 percent increase for all occupations. Some of this is because of the automation of less sophisticated tasks, like cataloging inventory, and buying for less stylistically demanding retailers (say, auto parts).

There is at least one area of the industry where the machines are creating jobs rather than eliminating them, however. Bombfell, Stitch Fix and many competitors in the box-fashion niche employ a growing army of human stylists who receive recommendations from algorithms about clothes that might work for a customer, but decide for themselves what to send.

“If they’re not overly enthusiastic upfront when I ask how do you feel about it, I’m making a note of it,” said Jade Carmosino, a sales manager and stylist at Trunk Club, a Stitch Fix competitor owned by Nordstrom.

In this, stylists appear to reflect a broader trend in industries where artificial intelligence is automating white-collar jobs: the hiring of more humans to stand between machines and customers.

For example, Chida Khatua, the chief executive of EquBot, which helped create an exchange-traded fund that is actively managed by artificial intelligence, predicted that the asset-management industry would hire more financial advisers even as investing became largely automated.

The downside is that work as a stylist or financial adviser will probably pay less than the lost jobs of buyers and stock pickers. The good news, said Daron Acemoglu, an economist at M.I.T. who studies automation, is that these jobs may still pay substantially more than many positions available to low- and middle-skilled workers in recent decades.

And these jobs may be hard to automate in the end.

“If I’m the customer explaining what I want, humans need to be involved,” Mr. Khatua said. “Sometimes I don’t know what I really want.”