You've pointed at a good flaw. Drogon would have been an equally valid target.
But there are some options here as to why the NK chose Viserion over Drogon.
1. Drogon is considerably larger.
Although the ice spear did penetrate Viserion's skin with relative ease, Drogon is a considerably larger and stronger dragon.
We don't know much about the ice spear and whether it has any magical qualities that help with killing dragons. But given that Qyburn's ballista would make for an effective weapon too, I'm going to assume that dragon scales can be penetrated by brute force alone, without any magic. The ice spear was thrown with a tremendous amount of force.
But maybe killing Drogon was a stretch. He's a bigger dragon, and looks to be more armored as well. Maybe the Night King wasn't sure that it'd kill Drogon, and therefore he focused on the smaller, weaker dragons first.
2. Drogon was on the ground.
Viserion was hit, couldn't fly anymore, and hit the ice with a considerable impact. When Dany flies away later, you can see that the mark Viserion left on the ice is by far the largest, thus showing that Viserion made a high velocity, high impact landing.
Drogon was on the ground. Even if he were to be hit in the same fashion as Viserion, he wouldn't hit the ground with such an impact, thus not knocking him out or killing him on impact. This may give Drogon (or Danaerys) the time to deal with the spear.
Viserion did lose a lot of blood very quickly; but Drogon is comparatively larger and more armored, would bleed less, and is maybe able to shrug it off more easily (similar to why stabbing a dog-sized animal with a dagger will kill it, but stabbing an elephant-sized animal will only wound it)
There is another thing to consider here. The spear hit Viserion under the wing. I'm not sure how much of a marksman the Night King is, but he hit Viserion in a place that would prevent him from flying, which is exactly how he should have taken Viserion down. It's also likely that the dragons are less armored near their wings, because armoring would chafe them during flying. They need a fair range of movement with their wings.
This is pure speculation, but if we assume that the Night King was aiming for a weak spot near the base of the wing, Drogon would not be a viable target as he was using his wings to rest on the ground, and therefore covering it. The weak spot would not be visible/hittable by the Night King.
Even if he could pierce Drogon's wing to hit the weak spot anyway, he had no line of sight to the weak spot and would be guesstimating his throw. Since this theory assumes that the Night King was aiming precisely, that makes Drogon a difficult target to accurately hit (exactly on the weak spot).
Comparatively, the flying dragons were better targets, as their weak spots are more exposed to those below them.
Looking at the linked image in GhotiandChips' answer, from the Night King's perspective, most of what he could hit on Drogon seems to either be pretty well armored, or invisible due to the wing covering line of sight to it.
3. Drogon couldn't escape right away.
It should have been clear to the Night King that Drogon was the transport dragon, carrying Dany and soon also the others. This slows Drogon down. He is also not able to just up and leave, because he can't leave Dany or the others, who will be quickly overwhelmed by the wights.
The Night King wasn't trying to kill one dragon, he was trying to kill multiple dragons. He obviously did not stop at killing one. Though we didn't see him throw a third spear, nor target Rhaegal specifically, it seems fair to assume that he was trying to kill all the dragons.
If he kills Drogon first, Rhaegal and Viserion can immediately fly away. They are already in the air, mobile, and they don't have to take people along with them.
If he kills a flying dragon first, Drogon can't just fly away. Not only will it take him more time to leave (due to not flying already), he also needs to load people, and presumably fly more safely so that the people do not fall off (evidenced by Jorah almost falling off when Drogon dodged the spear).
If you're trying to kill as much as you can, start by killing those who can run away to safety quickly, and kill the slow ones later.
4. Unknown and out of universe reasons
- Viserion was the weakest dragon, mentally and physically. Maybe that's why Viserion was targeted. Maybe dragons can resist the resurrection of the white walkers (or retain their identity), but Viserion is notably weak (as was Vyserys, who the dragon is named after). But this is pure speculation of course.
- It's a story. It wouldn't make narrative sense to kill the representative dragon first. Drogon is shown considerably more often than the others, because he is the representative of the dragons. This is similar to Thormund. We haven't seen any wildlings (excuse me, Free Folk) lately. Whenever the wildl... Free Folk have been part of the story, they have been represented by Thormund. Other representatives are Grey Worm (for the Unsullied), Daario (for the Second Sons), Yohn Royce (for the knights of the Vale), Jaqen (for the Faceless Men, who really should be represented by many faces to prove a point), ...
- It's classic exposition. When a villain introduces his doomsday weapon, he will usually showcase its ability on a random test subject. This is done to prove to the viewer that the weapon is real and deadly. I could point to another example from Rick and Morty. There is a scene where Rick is sad, but is not speaking (it's just music playing). He takes out a device, and a little creature, and kills the creature with the device. He then puts the device on his own head, clearly intending to kill himself. If the viewer did not see the first creature die, they would not understand that this is a suicide attempt (e.g. maybe it's a device to clear headaches). The same is true here. Viserion's death proves to the viewer that dragons can be killed by White Walkers. Up until now, that was never proven. It's possible that viewers thought that the dragons are the be all end all solution to White Walkers, but this scene proves that they are still risking their lives by fighting the White Walkers.