To anyone else who's puzzled by how this could be possible to beat - after fighting an enemy, you need to click the square _again_ to collect the diamonds ("XP", I guess?) to allow you to level up.
You want to empty the health to 0 before leveling up, because any extra experience goes into the next level. For each level, heart only goes up by 1 but experience needed to level goes up by 3. You need to reach 15 to kill the dragon.