A ragamuffin is someone, especially a child, who is dirty and has torn clothes. They looked like little ragamuffins. a dirty young child wearing torn clothes (Ragamoffyn, evil spirit in the 14th-century poem Piers Plowman by William Langland)
A muffin is a poor thing of a creature, a regular muff; so that a ragamuffin is a sorry creature in rags