If more than one Ditto face one another in a Gym, neither will transform. If so, it'll use its only other move outside of Transform - Struggle.