It’s not because Anakin told her
Ahsoka definitely knows that Palpatine is a Sith Lord. What’s more, she seems to know that he is extremely powerful, which suggests she might have known that he was Darth Sidious, the Sith Lord that Jedi knew had orchestrated the war:
The shadow was almost certainly one of the dark side’s creatures.
Ahsoka had no idea what sort of thing it might be, but whatever it was
couldn’t be that powerful, because it hadn’t been able to track down
Hedala. That ruled out Palpatine himself, not that the Emperor could
just show up on a planet without causing a great deal of alarm.
Ahsoka
The most obvious possibility would seem to be that Anakin told her. However, we know that as of the last time Anakin saw her, he was not aware of Palpatine’s true identity. From the Rebels episode "Shroud of Darkness":
AHSOKA: The last time I saw him, he was rushing off to save the Chancellor.
Then everything changed. The war ended and the Jedi were accused of
treason. One by one, they were hunted down. By the Inquisitors.
This is a bit ambiguous, but it refers to Anakin going off to save Palpatine from his "kidnapping" by General Grievous:
So she was caught up in that, and basically she says point, “The last
time I saw Anakin, he was rushing off to save the Chancellor.” She was
actually planning with Obi Wan and Anakin the capture and attack that
would get them Maul, because she had figured out where he was towards
the end of the Clone War. But before they can go through with this
plan together, Obi Wan and at one Anakin get called away to Coruscant
to save the Chancellor, which leaves her with Rex – and some other
exciting characters – to basically go and deal with Darth Maul, once
and for all. That’s kind of a good brief of what that was about.
So Anakin could not have told her that Palpatine was a Sith Lord. To the best of my knowledge, she had no contact with Yoda or Obi-Wan, the other two people who knew Palpatine’s true identity.
She probably deduced it
For someone inclined to think so, and with the knowledge that the surviving Jedi had, there was abundant reason to believe that Palpatine was Sith.
As mentioned previously, the Jedi knew that a Sith Lord called Sidious was behind everything, from the time of Attack of the Clones:
COUNT DOOKU: The truth. What if I told you that the Republic was now
under the control of the Dark Lords of the Sith?
OBI-WAN: No, that’s not possible. The Jedi would be aware of it.
COUNT DOOKU: The dark side of the Force has clouded their vision, my
friend. Hundreds of Senators are now under the influence of a Sith
Lord called Darth Sidious.
The clones turned on all the Jedi in the galaxy, after receiving an order that could only have come from the supreme commander of the Grand Army of the Republic: Palpatine. Who but the shadowy Sith Lord Sidious would have wanted to kill all the Jedi? What’s more, Ahsoka had Rex with her, so she knew the source of the command (as Rex would have guessed): the chips.
The Jedi were gone, but what happened to the clones was almost worse.
Their identities, their free will, removed with a simple voice command
and the activation of a chip.
Ahsoka
Palpatine declared himself Emperor, and the war ended quickly and suspiciously. This coincided with the fall of the Jedi Order. Who would have wanted this? Sidious. Sidious would have ended up in the position of greatest power once he won. It’s what Sith do—think Dooku as head of the Separatists, or Maul setting himself up as dictator of Mandalore.
Anakin went to save the Chancellor and didn’t come back. Ahsoka would naturally suspect betrayal, by the most likely suspect: Chancellor Palpatine.
Ahsoka has heard that Palpatine is using Sith or other dark side entities as his servants:
It also ruled out whatever Palpatine was using to track down surviving
Jedi. Ahsoka had heard rumors of a dark lord who served the Emperor,
but nothing confirmable.
Ahsoka
If darksiders are serving the Emperor, it’s a strong sign that he’s a Sith Lord.
This is basically the same reasoning that Palpatine himself suspecting Grand Moff Tarkin of using:
Tarkin may also have determined that Vader was a Sith. If so, it
followed that he accepted that Sidious was Vader’s dark side Master.
Tarkin