Presuming the rotor is true, and the caliper is post mount, loosen the mounting bolts so they grip slightly and manipulate the caliper so that the rotor runs in the centre of the slot, or close to it, without rubbing.
This may be difficult to achieve if you have a sticky piston. The answer to a sticky piston is different to the answer I am giving you.
If anyone answers “hold the brake lever tight when the caliper mounting bolts are loose, and tighten while holding the lever all the time”, they are wrong, but it occasionally improves things – if you are lucky enough for both pistons to be totally free and centred.
The Hope website often has videos regarding such jobs, and are applicable to most hydraulic brakes.