Start with smaller courses and ask someone to tell you them 3-5 times
Walk it , draw it on paper, draw it in the air before you go on, watch other people !
I find it fun to draw it out and follow with my finger, and then see if i can do it with my eyes closed. I also watch the other riders before me, watch to see if i notice difficult areas and memorise the track that way. :)
It takes time to build up this skill like any other skill, it helps to visualise it before you enter the ring. You can also verbally describe it to your self or someone. Using a variety of memorisation techniques helps you remember the course.