I keep trying to defeat it but in vain. I'd like some tips.
If you have a fairy type Pokemon , use it. Kommo-o is weak to Fairy moves by 4×. a fairy type is also resistance to kommo-o 's fighting move and immune to dragon move .While Mimikyu is also immune to it's Fighting and dragon moves.
I recommand mimikyu with disguise.
Hope I helped.
Use Oricorio with a flyinium Z. Oricorio can be found at Ula'ula Meadow and will quickly learn air slash. The flyinium Z can be found at Ten Carat Hill. Make sure it's pom-pom form before battling so it's not weak to thunder punch. Have it use its air slash-based supersonic skystrike on the first turn, and continue using air slash until the Kommo-O faints.
Oricorio is better than most other options because it gets a good Z-move very early and it can use its type-changing capabilities to be useful against many opponents other than the Kommo-O at this trial.
I used Mimikyu's Toxic and Golurk's Curse to complete the Dragon Trial because Toxic causes your opponent to lose an increasing amount of HP at the end of each turn and Curse cuts their remaining HP by 1/4.
I know this was asked a few years ago, and you most likely have beat the game by now, but for those who are still struggling with the battle; Get Salazzle that knows the move toxic. Use it on the totem Pokemon, and you basically don't have to even do anything after that, since the poisoning gets worse every turn. At least that's how I beat kommo-o :')
I would try to bet Kommo-o by getting a Pokemon that can use a dragon move such as dragon breath or outrage such as a goomy/ evolvotions ( witch is what I used) and can be found by mallows trial on Ula'Ula island as a sos alley in the rain (or gible/evolutions witch can be found in the Haina desert) or a ice move like ice beam or icy wind from a seel/ evolution and can be found in Seaward cave Melemele island and psychic Pokemon is abra/ evolvotions that can learn psychic moves like psybeam and confusion also the useful move disable (when evolved into kadabra) and is found on Melemele island near the Pokemon center near the mall and one Pokemon that is the most useful is Gyarados witch can learn at least 3 dragon moves and 2 ice moves through TMs Gyarados also has no noticeable type weaknesses to Kommo-o. Sorry for this to be soooooo long but I hoped it helps