Shakespeare’s portrayal of the commoners represents a way some people think, which is to be easily persuaded. Not only commoners, but educated people might also be easily persuaded to change their mind from one position to the next. Indeed, the “mob mentality” we see in the commoner’s new alligeance to Caesar is similar to the ease with which Cassius convinces Brutus, with no real evidence, that Caesar aspires to be crowned and should therefore be murdered. The attitude of Marullus and Flavius to the commoners in this scene is very rude: these men are only going about their business, and they want to see “Caesar and to rejoice in his triumph” (1.1 35), which hardly compares to their own evil intentions of murder. So, to answer you question more directly, I think Shakespeare’s portrayal of the commoners serves a dramatic purpose of introducing a theme of how people can be persuaded and of characterizing Caesar’s enemies more than it serves the purpose of realistically portraying an entire group of people. It is a way of thought, not a class of people, that interests Shakespeare here.
Shakespeare was a master of understanding the human condition. That's why his plays still speak to us today! In his tragedy Julius Caesar, when the commoners cheer Caesar after the defeat of Pompey, Marullus reminds them of how they had similarly cheered Pompey in the same streets. This shows how the crowd seems to be easily swayed in their allegiance. All it really takes to sway a crowd is some strategically placed "yea-sayers" amongst them who reiterate thier ideas loudly and consistently. Pretty soon those nearby join in. This is commonly called "mob mentality". In Jerusalem, just a few days after the cheering people were laying palm branches on the ground as Jesus Christ rode into town on a donkey, many of those same people got caught up in the chants of "Crucify him!" when his enemies placed themselves amongst the throng. So, yes, Shakespeare's portrayal of a fickle crowd is realistic.
This isn't so much an answer as a reply to sagetrieb. Flavius and Murellus have no intention of murdering Caesar, and are not among the conspirators, nor are they even members of the senate. In fact, they are never seen beyond act 1 scene 1.
In act 3, the commoners are swayed first to the plight of the conspirators by Brutus, and then to riot by Antony. They become so worked up that they forget the mention of Caesars will. Arguably, it could be said that Shakespeare thought of the common man as stupid and gullible.