The rapid rise and fall of coastal sea level due to tides and storm surge complicates the application of hydrodynamic models that use constant lateral boundaries in the region where sea level change falls within the tidal range or between the negative and positive surge extremes. In order to enable a hydrodynamic model for use in tidal or surge zones, an inundation and drying scheme must be incorporated into the hydrodynamic model. In this study, a mass-conserving inundation (wetting) and draining (drying) scheme is incorporated into a three-dimensional hydrodynamic model (the Princeton Ocean Model, often referred to as POM) for coastal ocean and estuarine systems. This coupled hydrodynamic and inundation modeling system is tested in an idealized lake/estuarine setting. The results show that: 1) incorporation of the inundation/drying scheme into the POM enabled its application in shallow water systems with time-dependent coastal boundaries; 2) the mass conservation constraint used in the inundation and drying scheme eliminates the problem of artificial flooding associated with the imbalance of water mass that is typical of a non-mass-conserving schemes; 3) using vertically-averaged flow as flooding velocity resulted in a reduced flooding area as compared to the cases that use the surface flow as the flooding velocity. This is partly due to the fact that vertically-averaged flow tends to be weaker and directed more parallel to the coastline than the surface flow.