With the sort of lathes members seem to be talking about here (Myford etc) I'd not recommend trying to make an oil cap unless 1) your lathe has a thread dial, 2) you've experience of thread cutting. The reason for the foregoing is that you need to thread up to a shoulder and that's not so easy. I have a Holbrook B18 (reckoned to be the best screw-cutting lathe made). That has low speed (10rpm), a comprehensive gear box and a device for rapid retract of the cross-slide without affecting the settings. With taper turning it'll even turn a taper thread (even with all that, threading to a shoulder requires thought). My other lathes (Boxford etc) have none of those features. Indeed, generally speaking, small lathes run too fast for screw-cutting, even in back gear.
For those not familiar with thread turning, the way I'd cut this thread:
Chuck suitable alloy and turn OD for flange.
Turn portion to be threaded to 1 1/2" dia.
With narrow parting tool, make an undercut next to shoulder to depth of thread (around .032")
Mount an internal threading tool (they're narrow enough to enter the undercut) to toolpost so it's behind the job.
Select reverse (head and feed), start lathe and get tool to just touch area to be threaded. Zero cross-slide dial. Stop lathe.
Select 20tpi on gearbox or via gear selection.
Select lathe speed to around 60rpm.
Bring tool to undercut and set cross-slide for a cut of around .015".
Start lathe and engage feed at a suitable point on the dial.
When past the end of the job, disengage feed, move tool away from job and return to undercut.
Apply an extra .015" (or thereabouts - just happens to be my usual cut when threading) and repeat above until thread depth is achieved.
Remember to advance the tool a thou or two on the compound for each cut.
Now re-set lathe to usual rotation and use parting tool to create correct width of cap flange. Remember it's domed, so using the compound instead of the cross-slide may help. Can do it with the latter, but requires experience.
Before going too far parting off, knurl the now exposed outer edge of the flange.
The above may seem complicated - it's not really, but it's necessary in order to cut a thread close to a shoulder. Cutting up to it is possible but risky, even with the fast-retract facility of a Holbrook. Which is why I laid out how to cut away from a shoulder. Trying to do it without a thread dial and having to leave the feed engaged the whole time would be near impossible.
PS. If your lathe is metric, you'll probably get away with threading at 1.25mm instead of 20tpi. (when a thread is short, it's possible to cheat a little sometimes).