WhatsApp uses Signal protocol which is by design offers plausible deniability in pairwise encrypted messaging. In pairwise messaging, every message is sent with
HMAC-SHA256 to verify the integrity of the cipher text.
HMAC uses a shared secret known to both sender and receiver.
Quoting from an answer on Difference between non-repudiation and plausible deniability
A recepient can prove the authenticity of the message that it is indeed sent by you. If it's not him who wrote the message then it must be you who wrote it. In either manner, both the sender and the recipient can verify who sent the message. But neither of them can prove authorship of the message to others. A recepient can easily forge HMAC with a valid key to make it look like sender has sent this. He can also give away the shared secret to a 3rd party to forge HMACs in future messages.
Also, once a message is delivered, the key is deleted so there is no way to prove authorship.
In WhatsApp, you don't even have to forge HMACs. All sent & received messages are stored in
Sqlite database file
msgstore.db in unencrypted form in the internal storage (
/data/data/com.whatsapp/files). A recepient can edit this file and modify any message that are sent by you to frame you for anything.
Even if Alice claims that Bob has sent her a message , she can't prove this to anyone. Bob can deny sending of any message sent by him.
Plausible deniability doesn't hold up in WhatsApp group messaging. In group messaging, a sender signs the message with its private
Signature key so they cannot be denied and that can be used by the law.
In a legal context, plaintext messages are almost always considered proof anyways regardless of whether the underlying protocol is deniable or not. So it also depends how judicial system in your country treats plaintext messages.