No, according to the legend, Ahalya did not know that she was sleeping with Indra. Indra, the king of the gods, used his divine powers to disguise himself as Gautama Maharishi, Ahalya’s husband, in order to seduce her.
Ahalya, who was known for her devotion to her husband, believed that she was sleeping with Gautama Maharishi and had no idea that it was actually Indra in disguise. It was only after Gautama Maharishi discovered the truth and cursed her for her infidelity that Ahalya realized what had happened.
The story of Ahalya and Indra serves as a cautionary tale about the dangers of temptation and the importance of staying true to one’s commitments. It highlights the consequences of succumbing to one’s desires and breaking vows, which can lead to shame, guilt, and punishment.