The @patch decorator is used to temporarily replace a function or object with a mock object. This allows you to test the behavior of your code without actually running the original function or using the original object.