Why do girls lie about having had boyfriends ?

When we say "clean" then there is no simple criteria to measure it. There are many many factors and their respective levels vary from one extreme to another. Unclean can even be only a single immoral lustful gaze in life for some cases, but for others it can be the worst limits a person can cross in a relationship.

BUT there are also ways to "unclean" a person in this life before marriage. Sincere repentance removes a lot of dirt from the body in the form of tears (No face in the mirror looks as innocent and pure after committing a sin as it looks after crying ones heart out in front of ones Lord and sincerely decide not to repeat ones mistake / sin).

Charity (sadaqa), helping people, remembering ones Lord, forgiving others mistakes, even smiling and having good wishes for others can become a source of ones cleanliness.

BUT if one doesn't clean oneself in this world, then nature might itself do the job in terms of any mental, physical or spiritual pain in life, in order to make one clean enough to deserve what one desires.

This is what I sincerely feel from past experiences and words of scholars, though I might be totally wrong. Allah (swt) knows BEST!