Yes I calculated it with an ancient green dragon (ac 21 and a bit below 400hp). Like you said, if the archers see the dragon coming, they can fire before being in his frightful presence, meaning about 1/5 of them will hit, lets say theyre goon-level and have +2 dex +2 proficiency. They´ll hit for an average of 6 damage per 5 archers, meaning 200 of them should deal about 240 damage (not calculating that about 1/4 of those hits should be crits). So in the first round the dragon should loose a bit more than half HP, but youre right afterwards it gets interesting, if the dragon doesnt retreat, he can use frightful presence, breath attacks, maybe even spells, but its not like he´ll get out of it without being severely injured.
Well, if the attack is happening during the day your dragons are not very intelligent.
On a dark night, your dragon can see 120 due to its superior darkvision, as where your goons won't even be able to see it to shoot (except the dwarves with 60 darkvision). But that means they can move into fear range and breath before the goons can even see it. The dragon could fly over head, land behind the enemy lines, and breath then start flying away again.
Even during the day, you are forgetting those attacks beyond 150 feet have disadvantage, nearly all within 120 will also have it due to fear. So, the odds for most of them to hit is really only 3.5%, slightly better for the few who make the DC 19 WIS save. Also, not all 200 will be grouped so closely to shot together (if they are, one breath will wipe most of them out!), many will probably not even be within
long range as they are likely spread out along the city walls. More reasonably, I think you might get 5-10 that are close enough and will actually hit, doing 30-60 damage in that first volley, not the 240 you think.
Sorry, it is one of my pet peeves when it comes to dragons. I've seen WAY to many groups not play dragons as they should be IMO given their insane mental abilities (your ancient green dragons have INT 20 and WIS 17!) and age, hunting experience, etc. If I was the DM, the party would be sorely pressed to save the city against a single ancient dragon, let alone TWO!
That is why I initially responded focus on the PCs against the dragons, with the rest being background noise, and hope it isn't a TPK.
EDIT: as
@Oofta mentioned (I think), siege equipment is the city's best hope against dragons. Better range, better chance to hit, better damage.