Here I am going to try and answer for you, with what other trainers have experienced while using or confronting Ditto in gyms.
Now, this is probably why Niantic took so long to add Ditto into the game. Its confusions like what does Ditto transform into if it is defending a gym and are there two attackers? What will happen if Ditto fights Ditto or can a trainer enter a battle with a Ditto while another battle with a different Pokémon is taking place? Here I am going to try and answer for you, with what other trainers have experienced while using or confronting Ditto in gyms.
Ditto Is Defending A Gym With Two Opponents, What Does It Transform Into?
First of all, as I explained in another article earlier this week when Ditto fights Ditto nothing happens and they both just simply don’t transform. But as for the other question, many Pokémon Go players have asked about, what happens when Ditto is defending and there are two trainers trying to capture the gym? Well then obviously, Ditto transforms.
But which one does Ditto transform into? Well through observations sourced from trainers on a number of forums, it picks the weaker Pokémon to transform into. There was a case where two trainers, one with a Vaporeon and the other with a Rhydon attempted to take down a gym with a defending Ditto. The Ditto decided to choose the Rydon to transform into despite, the Vaporeon being stronger.
But this doesn’t seem to be a one-off instance, as a number of players have also stated that this has too happened to them. I assume this is that case because if a low-level player was to try and take over the gym alongside a high-level player, then the Ditto would destroy the low-level player as even if Ditto was weak, as it would take the traits of the stronger Pokemon. But this may also work in favor of team battles in general as one player could enter a gym with a strong Snorlax, while the other could enter it with a Rattata and so have the Ditto transform into the weaker Rattata.
Also, another thing is that if you are attacking a gym with a Ditto, it seems it only transforms only once even if you win and go over to the next Pokémon. There you have it, I hope that cleared questions about battling Ditto in gyms with a teammate.