What you are looking for is called a 'backwater valve' and is placed on the builidng sewer or building drain to prevent sewage from backing up into the house.
But this valve may only end up masking other problems in the drainage system, like a blocked or partially blocked sewer line to the septic tank, a filled septic tank, or a saturated drainage field due to high water table.