Sometime we see in dreams that doing sex with a non mehram woman and when we wake up find a viscus liquid in trousers. So it will be counted in Gunah? As we all know we see in dream everything even which are not possible in real.
It is a type of wet dream, you need to do ghusl after it but it is not a sin since you can not control yourself while asleep. Wet dreams are quite natural and it is a sign of puberty.
The Messenger of Allah (ﷺ) said: "The Pen is lifted from the minor, the insane person and the sleeper."