A Ditto vs Ditto fight is cute but kind of pointless. In this particular instance, Transform always dealt 1 damage, but they can use Struggle at anytime, which has been updated to no longer require any energy. When one Ditto faints or switch out, the winner transforms into its next opponent.

Ditto only uses Transform once, at the start of the fight (unless it's fighting another Ditto). When fighting another Pokemon, it'll immediately transform without any input required, copying the opponent's:

When using Ditto against raid bosses, some trainers have posted videos showing that the Ditto becomes a Pidgey or Rattata instead of the raid boss (although other videos do show DItto successfully Transforming into the raid boss).

Quick and charge moves

Base stats

Pokemon type(s)

The following are unchanged for Ditto after transform:

HP and base stamina

Level

Individual values (IVs)

Ditto's CP will update to reflect all base stats of the other Pokemon even though its own base stamina is still used. As such, your 400 CP Ditto might transform into a 2027 CP Dragonite in a fight. It will not transform again for the remainder of the fight. When your gym match ends, Ditto will return to its original self.

It's worth noting here that the Transform animation is only visual. Ditto instantly transforms into its opponent at the start of a fight, even though it appears to take a second to do so. As an attacker, you can tap to attack or swipe to dodge right away without waiting for Ditto to finish transforming. As a defender, Ditto will attack with the same pattern as any regular defender.

There is a visual bug to take note of: when Ditto finishes transforming, it appears to regain all of its lost HP taken during transformation. This HP restoration never really happens. When Ditto next gets hit by an attack, its HP bar will update with the correct amount of remaining HP.

Defending Ditto

Ditto is very easy to counter in a gym, because you can control what it transforms into. Simply let it transform to another Pokemon that you can easily counter. For example, you can force Ditto to transform into a Flareon, then switch in a Vaporeon to beat it up. You can do even better by forcing it to transform into Pokemon that rely on a high HP stat but have low stats elsewhere, such as Chansey and Wigglytuff.

Attacking Ditto

Because of Ditto's paper-thin stamina, using it on offense is more fun than optimal. A perfect IV level 30 Ditto only has 81 HP to work with, for example. If you choose to use it, you want to have a high level Ditto. Transform into an opponent that can dish out damage fast, while you dodge until you faint.