It's a pretty unwieldy sentence, personally I would look to rephraise it if posisble. I don't have enough context to know what exactly to suggest.
I think the "in" here basically says we're treating Afghanistan as a location for this purpose, not an entity. It suggests that China can help Pakistan compete with India, including where those two countries have interests in Afghanistan.
If you remove the "in", China can help Pakistan to compete against India including Afghanistan, which seems to suggest that for this purpose Afghanistan is PART of India (obviously that's not true, I'm just trying to elaborate on what the sentence is saying).
I hope that helps