BEIJING — Lured by cheap iron ore and low wages, the Xiyang Group, one of China’s biggest mining conglomerates, took a significant risk, building a mine in economically backward North Korea that was designed to feed China’s steel mills and provide much-needed investment to China’s impoverished ally.

Now that deal is in tatters. Xiyang says that the North Korean government sabotaged its $40 million investment, allowing the company to stay just long enough to steal its knowledge, then seizing the iron ore mine and sending armed guards to evict Chinese workers. And recent sniping over the failed venture has exposed the often testy relationship between China and North Korea that, in public, remains hidden beneath vows of friendship.

The business spat came into the open last month when Xiyang posted a gritty, salacious blog item describing what the company called its “nightmare” in running the mine. It included details of high living by the North Korean managers when they visited China, where they were said to have demanded female escorts, expensive alcohol and cars.

In a follow-up blog post this month, Wu Xisheng, the deputy general manager of Xiyang, demanded that North Korea stop its “illegal activities” at the mine and pay $31.2 million in compensation.