Open the Messages app on your Mac → select a message from the contact from which you want to hide notifications → in the top-right corner click the ‘i” icon and mark the checkbox to Hide Alerts.