INDORE, India—The sudden lockdown in 2020 sent workers streaming from cities back to villages in rural India, an exodus that many thought would be an easy-to-reverse blip on India’s journey to becoming an industrialized nation.

Instead, the ranks of India’s farmworkers have swelled by some 60 million over the past four years, a shift fueled in part by a food-welfare program that feeds hundreds of millions of people. Even last year, when much of the country had put the pandemic behind them, India’s farms added 13 million workers, and Prime Minister Narendra Modi said the food program would remain for another five years.

Meanwhile, jobs in manufacturing nationwide haven’t budged, and factories say they are struggling to hire.

“This is catastrophic: You see millions going back to agriculture,” said Santosh Mehrotra, a development economist and visiting professor at the University of Bath whose analysis of government employment data shows the farm workforce growing since 2019. “This is the reversal of the structural change happening in our economy.”

It is the opposite of the path many economists would have expected India to be on, with gross domestic product growth outpacing that of other major economies. The country of 1.4 billion, which is estimated to have surpassed China last year as the world’s most populous, has average per capita income of roughly $2,400—less than that of Bangladesh.

Instead of seeing the masses move onto factory floors—a shift that helped raise the standard of living for millions of Chinese—India appears to be deindustrializing prematurely.

That puts India at risk of missing out on the benefits of a huge labor force, while much of its population struggles with chronic unemployment or underemployment. It also means that the world—which benefited when China’s economy grew, fueling demand for commodities and providing consumers with cheap goods—might not be able to count on India to be as powerful an engine of global economic growth.

Modi has long promised to create tens of millions of jobs. But some blame his signature economic policies, including measures enacted in his first term aimed at combating tax evasion, for instead creating headwinds to job growth.

Economists and factory owners also say that for some workers, the food program, whichthe government has billed as among the world’s largest welfare programs, is helping to tilt the scales in favor of staying on the farm.

The prime minister’s office didn’t immediately respond to requests for comment.

During the pandemic, India started offering 5 kilos of rice or wheat each month to help those who had been affected by the lockdowns, a benefit that covers 800 million people. With national elections looming in early 2024, the government said in November that it would extend the program for an additional five years at a cost of $145 billion.

In an industrial hub home to some 1,000 factories in the central Indian city of Indore, the managing director of Porwal Auto Components, a foundry and machine shop, said he used to count on about 1,000 welders, spray painters and other skilled workers before the pandemic. Now Devendra Jain said he is operating with about 700, and struggling to complete orders for components for the truck industry and railways. His suppliers are facing similar issues.

“There are hardly any workers,” he said, attributing the shortages to benefits that workers receive in their home villages. “Getting to full production is going to be a challenge.”

Mahesh Khatri, a businessman in the northern state of Haryana, near India’s capital, is struggling to fulfill orders to supply 10,000 cardboard boxes and adhesive tape every month with 38 workers, from an earlier workforce of 55.

Khatri offers free accommodation, but it hasn’t helped.

“They prefer being poor in their villages to being poor in cities,” Khatri said.

The number of people working in farming in India started declining around 2005, hitting a low of just under 200 million by early 2019, the economist Mehrotra’s calculations show. Since then, their numbers have soared to over 260 million—not far from the number of farmworkers India had two decades ago, at the peak of agricultural employment. Many of them aren’t working for pay, but on their family farms.

Employment in cities has declined by nearly nine million over roughly the same period.

India’s decadal census provides the absolute number of people working in different parts of the economy, but the country hasn’t carried out a census since 2011, in part owing to the pandemic. Mehrotra’s calculations involve applying the labor data that New Delhi periodically publishes to government population projections.

The rise in rural employment comes despite Modi’s move to offer tens of billions of dollars in incentives to companies to set up shop in India, as companies seek to move some of their manufacturing from China because of growing U.S.-China tensions. Economists said that companies have used the incentives to set up more manufacturing in sectors such as electronics and pharmaceuticals, but those factories haven’t translated into a significant boost in jobs nationwide.

Manufacturing’s contribution to India’s GDP has fallen from around 17% two decades ago to 13% in 2022, according to the World Bank. India has added only five million manufacturing jobs since shortly before Modi was first elected, for a total of 65 million such jobs now.

Because manufacturing has been so lackluster, India’s economy—which will grow at around 7% in its current fiscal year that ends in March, according to its central bank—is instead being fueled by sectors including information technology and financial services, which don’t need to employ lots of people.

“The growth has come from sectors that aren’t job-intensive,” said Amit Basole, a professor of economics at Azim Premji University in Bengaluru. “So for a fixed amount of output growth, you don’t get as much employment growth.”

Economists say that a government infrastructure push is, however, boosting construction jobs, which were a major source of employment growth in the early 2000s. These jobs could grow further if the government continues to spend tens of billions of dollars on adding new essential infrastructure.

Discontent among migrant workers in big cities had been building up over the years, factory owners and workers say, as slow job growth kept a lid on wages, while housing and food costs rose.

Workers at small-scale factories in poorer states report taking home around 10,000 to 12,000 rupees a month, or about $150. In villages, some are reporting similar earnings with a combination of farming, some private work, and income from a state-run employment program begun under the previous Congress government.

Deepak Porwal, who returned to his village in the central Indian state of Madhya Pradesh during the lockdown in 2020, said he tried many times to find work in a city but didn’t find anything that made financial sense. Now he focuses on farming a 2-acre plot growing soybeans, and works on the side as a local insurance policy agent, earning all together about 12,000 rupees a month.

“A lot of factories and companies are still closed. Those that reopened offered less than half what they paid three years back,” said Porwal, a 35-year-old from Khejdiya village. “We are hardly able to send anything back. Is there any point in staying away from your family and village to earn a tiny amount?”

The food program helps families save on their food bill, but it also bolsters rural incomes in another way.

“You’re assured of the government buying some for the free food program,” said Himanshu, an associate professor of economics at Jawaharlal Nehru University in New Delhi, who goes by one name. By law, the government is required to pay a price that covers expenses, which means it sometimes pays above market prices. “It provides price stability and keeps prices from collapsing.”

Still, he cautioned, the subsidies provided aren’t high for any one family. If “jobs were created, people would still move to urban areas.”

Despite the angst among millions of Indians over employment, Modi remains extremely popular, with a public approval rating of 77%, according to the research firm Morning Consult. Political analysts credit his ability to connect with everyday Indians, many of whom support his vision for a strong, Hindu-majority state. Modi and his ruling party recently performed strongly in a series of regional elections and are widely expected to return for a third term in the coming elections.

But continued weakness in India’s job market—especially in the midst of other signs that the economy is doing well—could undermine Modi’s support over time and lead to rising discontent, said Suyash Rai, a fellow and deputy director of Carnegie India, a New Delhi think tank.

In recent years, India has seen major protests over government jobs, which have become even more sought after amid slow private job growth. Violent protests erupted in two states in 2022 after more than 10 million people applied for 35,000 jobs with the national railroad system, which one Indian newspaper suggested could be the country’s “first large-scale unemployment riots.”

In December, a surprise protest in India’s parliament appeared to stem, in part, from frustrations from inadequate employment. In the incident, at least one person jumped into the lawmakers chamber and set off a canister of colored smoke while chanting slogans against the government. The group of young people who planned the protest, and who are now under investigation on terror charges, were educated but largely unemployed—or had returned to their hometowns to work in farming. At least one had organized previous protests over jobs.

“When you have tasted progress, you want more,” said Rai. “If there is no growth on that or not adequate improvement, that is something that can create political upheaval.”

Write to Shan Li at shan.li@wsj.com and Vibhuti Agarwal at vibhuti.agarwal@wsj.com