How to set the max distance for depth camera to avoid infinite depth problem?

Its the clipping property of the camera prim

You could also modify the numpy array either in a custom writer or in post processing.