Mr. Dostum rose to prominence as a pro-Soviet commander in the 1980s, fighting against the Afghan mujahedeen. Since then, he has carefully selected his allies, often switching sides during the conflicts that have consumed Afghanistan for much of the past 30 years. One of the most powerful, and lucrative, connections he made was with the C.I.A., and he was part of the movement that supported American forces in ousting the Taliban in 2001. Later, he joined with President Hamid Karzai as he governed for more than a decade.

Mr. Ghani, who years ago publicly described Mr. Dostum as a “known killer,” selected him for his running mate last year in his campaign for the presidency, an arrangement brokered by Mr. Karzai. Since then, Mr. Ghani has stood firm in his choice.

During the election campaign, he called Mr. Dostum a “charismatic leader” and said his choice was meant to bring peace and inclusiveness. It was a clear acknowledgment of the deep regard Mr. Dostum still enjoys within Afghanistan’s Uzbek minority.

But right away, Mr. Ghani was also careful about how he deployed his running mate. The vice president was the main event at rallies in northern Afghanistan, drawing tens of thousands of fervent supporters and upstaging Mr. Ghani at times. But Mr. Ghani kept him from campaigning in the south and east, where the Pashtun population dominates.

Since then, the marginalization has deepened, and Mr. Dostum has been kept from the inner circle of decision makers in the palace, according to several Afghan and Western officials who spoke on the condition of anonymity to discuss internal politics.

Mr. Ghani has instead stuck with a cadre of loyalists who have little use for the Uzbek strongman. According to Afghan officials familiar with Mr. Dostum’s outbursts, the vice president has warned Mr. Ghani that he is surrounding himself with “fascists.”

Some officials see Mr. Ghani’s balancing act with Mr. Dostum as a way to fulfill a commitment to keep people with unsavory pasts out of prime decision-making roles. But it is clearly not going smoothly so far.