As noted in the comments, the answer primarily lies with the DM.
However there is precedent beyond the folk hero background for a possible way to train NPCs.
First: How can an NPC be trained?
A character might be offered special training in lieu of a reward... Possible training benefits include the following: The character gains inspiration daily at dawn for 1d4+6 days. The character gains proficiency in a skill. The character gains a feat. (DMG 231).
Emphasis mine. Feats and proficiencies can replicate many of the basic class abilities. Specifically, Weapon Master gets you 4 weapon proficiencies, Lightly Armored, Moderately Armored, and Heavily Armored get you armor proficiency, and Magic Initiate can get you some spells. So, provided your PC is sufficiently skilled to offer "special" training, it would seem that they can impart some level of skill to the peasants.
Second: How long does this take?
This is more heavily reliant on the DM. However, I believe the rules provide some boundaries. Utilizing the Training to Gain Levels variant (DMG 131), we find that it takes 10 days for a PC with all the requisite experience to gain levels 2-4. To be conservative with our boundaries, attaining levels 17-20 require 40 days with all required experience. I feel that 40 days is the absolute minimum to achieve anything since the NPCs don't have any experience, but you aren't trying to get them all the way to a full-fledged 1st level PC.
For setting the ceiling, note that it takes 250 days for a PC to learn a new language or how to use tools (PHB 187). Since a lot of weapon motions mimic actions peasants take on a daily basis (chopping wood=>chopping, threshing wheat=>slashing etc) you could argue that 250 is the maximum amount of time (again, this is heavily dependent on the DM).
As for the amount trained at a time, weapon and armor training can be done en masse assuming you have a few assistants. Magical training is more likely to be small groups/individuals.