According to Bulbapedia, a guy in the Hano resort teaches Meloetta Relic Song
"By Move Tutor
Various Move Tutors will teach Relic Song to a Meloetta. According to interface text during the scene in Generation V, Meloetta once knew Relic Song and had forgotten it. The Move Tutors are:
BWB2W2: a Musician in Café Sonata in Castelia City.
XY: an Ace Trainer in Snowbelle City.
ORAS: a man in Crooner's Café in Mauville City.
SMUSUM: a Gentleman in Hano Grand Resort."
Hope this helps! :D