Yaarel
🇮🇱 🇺🇦 He-Mage
According to the 5e "Commoner" statblock, they do have a +2 to hit comparable to a Proficiency. The statblock Abilities are all +0 (Score 10). But an array of 13,12,11,10,9,8, or as I do to avoid negatives 13,12,12,11,11,10, would increase the hit to +3.Commoners do not have long bow proficiency as it's a martial weapon so they don't add any proficiency bonus. They also are listed with a 10 strength. So they need to roll a natural 19 or 20. And the commoner archers are shooting at disadvantage because it's beyond the regular reach of a longbow of 150'. An adult red dragon has an AC of 19. So each of the 300 commoners need to roll a double 19 or 20 to hit.
My back of the envelope estimate is each militia member has 0.01 odds of hitting each round. So I think 3 hit each round. Each hit does 4.5 damage (though I realize I didn't calculate crits there, I'd need to do the odds of rolling double 20s to crit). The dragon will take 13.5 damage each round (a bit more for crits). The adult red dragon has 256 hit points so needs 57 hits to take it down, or 19 rounds in this scenario . And that's not counting the militia members who are frightened and don't even get to fire in a round and the DC to save against their Frightful Presence is Wisdom DC 19, and commoners have a +0 to Wisdom saves, so the overwhelming majority will be afraid as it has a 120' radius. Those not afraid will be the ones dying every round, and I didn't include deaths from the Dragon in my analysis either.
If that is correct, then I don't think the militia is going to succeed in killing the dragon.
Meanwhile, the official Soldier statblock (found in Ravnica), indeed has the 13,12,12,11,11,10 array. It lists a longsword as the weapon, but can easily be a proficient Martial longbow for an artillery unit soldier.
In medieval Britain, it was routine for citizens to train militarily in longbow, especially the poor, because the wood was more affordable.