Declan Kirkham, aged 22, admitted to police that he had sex with her on two occasions, although he said he believed she was 16.
However, investigations found he was told she was underage by multiple people.
Shrewsbury Crown Court heard how the girl was found drunk outside a church in a village near Shrewsbury. Paramedics were called and she told them that she'd had sex with her boyfriend.
Kirkham, of Langford Avenue, Bayston Hill, near Shrewsbury, was later arrested.
Further investigations found that after the first occasion, Kirkham had been told by several people of his own age and the mother of one of his friends that the girl was underage.
Kirkham first got involved with the girl in November 2018 and committed the first offence on the night of December 27, 2018.
He pleaded guilty to sexual activity with a child.
Mark Connor, defending, said Kirkham was "not a particularly mature 18-year-old" when the incident happened, and that it had been "hanging over his head" for a long time.
Judge Peter Barrie had stern words for Kirkham.
He told him: "Eighteen-year-old lads must understand that when the law says girls should not have sex before they are 16, that is serious.
"This is not a case of two people in the same year at school messing around. She was 13. You were an adult. She was three years short of being allowed by law."
Kirkham was handed a 24-month community order. He must also do 100 hours of unpaid work, a sex offenders' programme and 10 rehabilitation activity days.