A young mum who made a false rape allegation has been given a stern warning by a judge as she avoided a jail term.