It was early when I tackled this question so I will take another stab at it.
Me preguntaron si te conocía, pero les dije que no.
Les dije que no = I told them no. The sentence says the answer I gave was to them so we use an indirect pronoun for them, hence les.
Now, as for the sentence I gave earlier, that is what Google Translate (GT) gave and I don't know why.
If I ask GT to translate "I told them no" it gives "les dije que no". But if I ask GT to translate "They asked me if I knew you, but I said no", I get "Me preguntaron si yo te conocía, pero me dijeron que no." Why this translation? Is there something we are missing?
If I rephrase it to "They asked me if I knew you, I told them no", then GT gives "Me preguntaron si yo te conocía, pero les dije que no."
Beware of Google Translate.