Yes, it's by the Message-ID header value (as long as the header's value is proper syntax where it isn't ignored by Opera). The body content doesn't even have to be the same.

Doing things this way is fine as the header value should be unique to its message. No need to do an SHA-256 sum of the messages and compare for example.

There's nothing wrong with having more advanced options for duplicate handling though. Opera Mail jst doesn't have any.