You can lock the Transform Origin to prevent it from moving when you click and drag in the 3D view; this does not stop you from repositioning it using the Tool Settings: Transform panel.
To lock the Transform Origin:
The Transform Origin changes to dark blue in the 3D view and cannot be selected.