Which side is Yamato on?
It looks like Yamato was unconscious thus his body was being used as a tool by Zetsu like how Obito corpse is being used by black Zetsu.

So Yamato is on the side of the shinobi alliance.