In court on Wednesday, Robert Broatch, 19, of Fieldfoot, Ruthwell was also made the subject of a community payback order with conditions he be under supervision for 12 months and carry out 100 hours unpaid work.
He had admitted two charges involving the sending of sexual comment and images to the girl on various occasions between October 31 and November 23, 2014.
The court heard that the girl had been given a laptop by her parents to help with her studies and was specifically told not to create a Facebook account.
They later became suspicious and found the items when they checked the laptop.
It appeared that Broatch had asked the girl her age, but she had not divulged it.