Could the Soviets invade Afghanistan during or shortly after the Russian civil war and install a communist government similar to what happen to Mongolia
The analogy does not really hold because Outer Mongolia had been a Russian sphere of influence before World War I, whereas Afghanistan had been a buffer state between British India and Russia. Hence, having driven out the White Russians from Mongolia, the Soviet government could in effect re-establish the protectorate without any real opposition from any powerful nation (China was too weak to do anything about it and Japan at the time satisfied with influence in Manchuria and Inner Mongolia). By contrast, invading Afghanistan would invite a conflict with the British that the Soviets in the early 1920's could not afford. And the risks involved would be quite unnecessary, because Afghanistan under Aminullah Khan
https://en.wikipedia.org/wiki/Amanullah_Khan had fairly good relations with the Soviets, whom they tried to use to counteract British influence. Indeed, Afghan-Soviet relations under Amanullah were so good that when he was overthrown in 1928 the Soviets tried to restore him:
"The swift pace of Amanullah's reforms and efforts at modernizing Afghanistan, however, ultimately produced a revolt in November 1928 that drove him from power. In an inept effort to regain the throne for him, the Soviets sent 850 to 1,000 men into northern Afghanistan disguised as Afghans and under the nominal leadership of the Afghan ambassador. During April-June 1929 this force captured Mazar-i-Sharif and Tashkurghan and moved toward Kabul, but it was withdrawn in the face of international disapproval. In June 1930 the Soviets again sent a force into Afghanistan, this time in 'hot pursuit' of the Basmachi leader Ibrahim Beg. The resolution of this issue led to the signing of a second treaty, the Treaty of Neutrality and Nonaggression of 1931, between the Soviet Union and the government of the new Afghan king, Nadir Shah. Despite this new treaty, both Nadir Shah and Zahir Shah, the king who succeeded him in 1933, grew disenchanted with the Soviets and distanced Afghanistan from the USSR in the 1930s..." Larry P. Goodson,
Afghanistan's Endless War: State Failure, Regional Politics, and the Rise of the Taliban, (Seattle: University of Washington Press, 2001), p. 47.
http://books.google.com/books?id=6pbIziLpG7cC&pg=PA47
If in the face of "international disapproval"--even Persia and Turkey, sympathetic to Amanullah's reforms but also suspicious of Soviet ambitions, protested--the Soviets backed down in 1929 (when they weren't even trying to install a communist government) it is really hard for me to see them trying to communize Afghanistan in the early 1920's when the Soviets were much weaker than they would be in 1929, and the Afghan government more friendly.