You will need:
1) A Pokémon that only knows Recycle
2) A Pokémon holding a Leppa Berry that knows Trick (HarvestSwap Exeggutor / Trevenant will work, but is not necessary)
3) A Pokémon that knows Substitute, False Swipe, a damaging attack, and Thunder Wave
Have the first Ditto transform into the Pokémon that only knows Recycle. Switch out and Trick a Leppa Berry onto it. Switch out into your third Pokémon and use Substitute, then False Swipe. Substitute will prevent new Dittos from transforming into this Pokémon, both through the use of Transform and Imposter. However, I could be wrong, but I don't believe Imposter triggers at all if you have a Sub up, so you won't immediately know when a HA one appears. Because of this, you'll want to use Thunder Wave on each Ditto that appears (after the first 10, since those have a 0% HA chance). Its ability will either be Limber, and prevent paralysis (thus signaling that it needs to be KO'd), or it'll be Imposter, and be paralyzed (which prevents it from calling new allies). Once it appears, you can either immediately try to catch it or, if you're worried about it Struggling, switch back into the Recycle Pokémon, have it transform, then switch out again and move the Leppa Berry from the first Ditto to the HA one.