Apple Mail marks mail as read when searching
There is no setting in Mail to fix this problem. People have been notifying Apple about this bug since at least 2006. Obviously, Apple has no interest in fixing it. You can get plug ins to fix it. Truepreview, which is free, and Act-On from Indev.ca, which costs about $25. (Act-On's main purpose is to allow you to apply rules to messages as you send them.)

There may be others.