This question uses the European dragon model where dragons have semi-metallic scales (may or may not have actual metal scales), like to hoard gems, and possibly fly around in storms for the heck of it. If it is also the kind that somehow has treasure stuck to its body, is there a chance of it being hit by lightning while flying? If so, what is the extent of the lightning damage?
Anything can be hit by lightning, as long as it can get in lightning's path, dragons included. Animals, in particular, are more conductive than dry air, so they provide an easier path for the lightning to travel though.
The real question would not be whether they can be hit by lightning, but whether they can survive it. That depends on how the electricity flows through the body. If it has metal conductive scales, it is likely that the lightning will mostly flow around the body doing little to no damage. This is similar to what happens when an airplane is struck by lightning.
If there is no convenient conductive shell, the lightning will travel through the body. If the current travels through the heart or brain, the effects are almost always fatal. A lightning strike can deliver literally thousands of amps of current while the human heart needs a scant few thousandths of an amp to be permanently put out of action.
However, it is possible that the shortest path to ground does not include the heart or brain. There are cases of people surviving lightning strikes that took a different path through the body.
Any treasure attached to the body of the dragon is unlikely to have any major affect on whether it gets hit, but if the treasure has a sharp corner, it is more likely that the electricity will enter or exit from that point. That's because sharp corners on conductors concentrate electric fields. This is why lightning rods tend to consist of very sharp points, and while van de graffe generators (which want to reach the highest voltage possible before discharge) rely exclusively on smooth surfaces.
In this answer, I'm mostly going to try to explain the issue with the statement:
doing little to no damage that Cort made.
This is very simply an over-generalization. If the scales are somewhat conductive (that is to say, not a theoretical ideal conductor with resistance equal to 0), there is going to be some energy dissipated inside of the scales themselves, as they are conducting current.
Depending on the current distribution of the lightning, the resistance of the scales, actual composition of the scales, the tissue beneath the scales, the results can be from no damage to extremely lethal damage that could kill the dragon and affect others in the nearby area.
I myself am coming from the electrical engineering area, and one of the first things we need to learn is to treat the tiny cheap multimeters as hand grenades. Here's a couple of videos showing somewhat extreme results: https://www.youtube.com/watch?v=HaIszMlrQNE and https://www.youtube.com/watch?v=i9jpwGTy66g for example.
Next, it's also good to take a look at how some fuses work, because normal small glass fuses can show some pretty interesting results when exploding. Here's a nice video about that:https://www.youtube.com/watch?v=qgz1lskyYDU
OK, so why did I mention those videos and talk a bit about that? The question is about dragons, not multimeters!
Well, what I'm aiming at is that our dragon, when hit by a lightning, will act a bit like a fuse in a circuit, depending on the intensity of lightning, of course.
So when lightning hits our dragon, it's most likely going to hit on a spiky bit of scale, due to the way electrical fields work. The spiky bit will have lower volume, meaning it will have lower heat capacity and its conductivity could also be lower, in case the volume is smaller than the skin effect. The result is that the point of initial contact can rapidly heat up. It might explode, sending covering nearby area with fragments and molten pieces of scale. The pieces of scale could turn into highly conductive plasma, and the exploding bits can feed the plasma further. As the spikiest bit is disintegrated, we can expect a bit of sparking around the initial impact area, which will cause extra surface damage and might make even larger area melt and explode/turn into plasma.
OK, so let's progress along the conductive path through the scales along the body. The path itself will rapidly heat up, but, again depending on the intensity of the strike, I would expect the results not to be as extreme as at the initial impact point. The heating could cause damage to the scales by melting them partially, so we might expect some surface damage and perhaps some internal burns to the tissue directly beneath the scales. There is a high probability that there will be more than one current path along the scales of the dragon, widening the damaged surface. We could expect so-called Lichtenberg figures to form along some of the tissue directly beneath the scales. Keep in mind, if we have, let's say 10 kA of lightning current, and if our scale piece has resistance of 0.1 Ω, this will still give us 1 kV across the piece of the scale, which could be enough to cause dielectric breakdown of the tissue directly underneath the scales. Of course, this will cause extra burns and similar effects.
Then we'd have the exit point of the lightning. This will again be most likely a spiky point near the other side of the dragon, with effects that might seem similar to the entrance point.
Now up until now, we've only had one lightning strike. In real life, it's quite common for lightning to manifest itself as a series of very rapid strikes. Basically, each strike in the series could cause such damage individually. Depending on the luck, already damaged areas might be struck several times, creating even more serious damage.
Let's not forget the other side-effects of the strike itself. If the dragon is struck while in flight, the sudden damage could cause disorientation and result in a crash. If the dragon is conducting an airstrike, especially if in formation with other dragons, this could cause even more issues.
If the dragon is hit by lightning-based short-range AA (such as wizard casing lightning), then debris from the dragon could hit defenders on the ground or divert their attention, perhaps force them to take cover.
One source for real-life information that might be representative of the lightning danger is damage to aircraft from in-flight lightning strikes. Here's a nice article about that from Boeing. The summary is that majority of lightning strikes that struck US commercial planes occurred between 6 and 14 thousand feet. The lightning will regularly punch holes through metallic skin of aircraft. Top leading edges of planes are most likely to be the initial contact point, due to their ionization, while the exit points are usually at bottom rear of the plane.
Finally, another thing that should be kept in mind is that lightnings occur not only from clouds to the ground, but also from ground to clouds as well as between clouds themselves. This could lead to some potentially interesting lightning strike scenarios. Also don't forget that lightning strikes are not evenly distributed across the surface. There are areas that are more prone to them and areas that are less prone to them.