Either “He told me I was pretty,” or “He told me I’m pretty,” would be correct here. A good strategy is to type the usage you’re wondering about into a search engine, in this case "told me I'm" and "told me I was", to see when and how native speakers use them in writing.
In formal English, the rule is that the verb tenses in a sentence should agree with each other. Since someone observing me in the past could only comment on my appearance then, not now, the more logical choice is “I was pretty.” The present tense is appropriate for timeless statements (“Euclid proved that the square of a hypotenuse is equal to the sum of the squares of the legs.”) In the most formal written English, older books will tell you to use the subjunctive for counterfactual clauses (“he thought I were”) but that’s gone extinct.