I find a solution after trying, first you need to get a shp file for ocean mask(the coastline file can't do):
import geopandas as gpd
sh1=gpd.read_file(r"F:\MASK\ne_10m_ocean\ne_10m_ocean.shp")
sh1_proj=sh1.to_crs(ccrs.NorthPolarStereo())
sh1_proj.plot(ax=ax, color='w',)
make this layer between your data and the gridline, that will make a satisfying mask. Maybe you don't want to set the zorder, because that may cause error on the display of gridline latitude label.
This solution doesn't fix the problem of cartopy, so it is still worth discussing.