When being sarcastic, usually what is being said is opposite to the truth but in an expression or tone which can give away that one is being sarcastic. So is it considered forbidden and same as lying?
You can divide sarcasm into two types:
Not involving lying
The second is in the Quran itself, so that is definitely halal:
Those who defy Allah’s signs and kill the prophets unjustly, and kill those who call for justice from among the people, congratulate them of a painful punishment. (3:21)
As you can see, Allah did not make any lying statement, but the sarcasm was instead with his word choice of using 'congratulate' for a punishment.
But, the other type of sarcasm is basically lying but meaning the opposite. Something like this:
Person A: You have got to believe me!
Person B: Sure, I believe you.
This type is not good and should be avoided. Lying is a sin in Islam:
The Prophet (ﷺ) said, "Whoever does not give up false statements (i.e. telling lies), and evil deeds, and speaking bad words to others, Allah is not in need of his (fasting) leaving his food and drink." (Sahih Bukhari)
"The sign of a hypocrite is that whenever he speaks he lies, and whenever he makes a promise he does not fulfill it, and if he is entrusted he betrays." (Jami Tirmidhi)
"Woe to the one who talks about something to make the people laugh, in which he lies. Woe to him! Woe to him!" (Jami Tirmidhi)
Abdullah said, "Lying is not correct, neither in seriousness nor in jest. None of you should promise his child something and then not give it to him. (Adab Mufrad)
"They said: 'O Messenger of Allah! You joke with us?' He said: 'Indeed I do not say except what is true.'" (Jami Tirmidhi)
It is still considered lying regardless of the unsaid meaning.
The third hadith above clinches it since the Prophet (SAW) did not even allow lying for humor, and sarcasm at its best is humorous and at its worst creates negative feelings between people. So, it is not allowed so much that the Prophet (SAW) cursed the one who does it.