Your idea to override the forward method sounds right and you could either derive a custom class from the ResNet class provided by torchvision or copy-paste the code directly from here 2 (you might need to fix some imports, too).
Once this is done, define your custom dropout layer as an nn.Module and use it in your model.
Don’t forget to switch its behavior using the internal self.training flag so that you can disable it after calling model.eval() (assuming this dropout layer is also a no-op during evaluation).