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.