Tesla Inc. might drive away from India, and the country has only itself to blame.

On Friday, Tesla Chief Executive Elon Musk tweeted that his company wouldn’t put a manufacturing plant anywhere it isn’t first allowed to sell and service cars. His tweet was a response to a user asking about his plans to make electric cars in India.

For the past three years, India and Tesla have been sparring over market access and the conditions under which Tesla would consider manufacturing there. Prime Minister Narendra Modi’s government wants Tesla to make cars locally from the get-go. Mr. Musk wants lower automobile import taxes, which can be as high as 100%. Tesla appears to want to test the market with imported vehicles before committing to any production in India.

India’s unwillingness to compromise looks shortsighted as China’s tough Covid-control policies are pushing many foreign companies to get more serious about diversifying away from the world’s factory floor. The Indian government might fear that allowing Tesla to easily import cars would hinder plans to attract other EV makers to the country, but India’s own market for such high-end EVs is minuscule.

Moreover, India might be on the cusp of losing out to nickel-rich Indonesia. Indonesia’s president visited Mr. Musk in Texas earlier in May. Bullish comments from Indonesia’s investment minister, reported by local media after the visit, suggest negotiations for a Tesla plant in Indonesia might be under way. The Southeast Asian country has attracted sizable investments in the EV battery space from the likes of LG Energy Solution and China’s Contemporary Amperex Technology Co.

India wants EV sales to account for 30% of private cars and 70% of commercial vehicles by 2030, and has unveiled incentives for manufacturing as well as demand. But despite the obvious potential and rapid growth, EV car sales remain very small for now: just about 1% of total car sales, although two-wheeler EVs are more popular. The average price of cars sold in India is about 926,708 Indian rupees, equivalent to $12,000, according to data from JATO Dynamics, an automotive market research firm, versus the average cost of $52,200 for a Tesla.

India has some things going for it: a large population and low-cost labor. But it lacks advantages such as abundant raw materials for batteries. And success in attracting investment from other auto makers is a mixed bag so far. Mercedes-Benz plans to roll out a locally assembled EQS—the electric version of its flagship S-Class sedan—this year. Ford, however, recently dropped its plans to make EVs in India.

If India dreams to compete with Southeast Asia, much less China, as an EV hub it either needs a large and lucrative domestic market or export-friendly policies. Snubbing the world’s largest EV maker doesn’t count.

Write to Megha Mandavia at megha.mandavia@wsj.com