Just had that problem a week or so ago with dipstick in my work truck, M11 Cummins powered, it lasted about 4000 hours and started working itself loose every day, time to replace.
Are you talking Cummins. The first M11s were to have twist lock dipstick installed which also adjusted oil level down. I forget what the l10s had but you could likely make something to help hold stick in if new one don't fit tighter. I think the main time I have seen a dipstick come out is on the C series Cummins and I believe they just weren't installed all the way after checking oil. Make sure you blowby tube is not plugged.
That should have a twist lock dipstick. Can't imagine it could come out. Have dealer check for bulliton or give me your serial number and I'll check it out. I know blowby tube is small and runs for quite a distance but they've never gave me any trouble. If your worried about blowby tube then maybe you should put a bigger one on.
We have had the same problem with our R72 from day one.The cummins mechanic had seen the problem before and his solution was to use a center punch and lightly tap dents on the inside where the dipstick locks to.But after a couple more incidents I gave up and now use tiewire to make sure that dipstick won't pop up.The thing I found was if the dipstick was going to pop out it would do it in the first 10 minutes of operation or not at all that day after checking the oil level.
Sounds like you have the 300hp l10 which I believe has the standard slip in dipstick like the first 330hp M11s had before Cummins and or Gleaner installed the twist lock dipstick that lowered the full line on dipstick to prevent overfilling by about 4 quarts. If you have the '96 or newer 330hp M11 without twistlock dipstick that has remarked full line then check with Cummins to get it. I have no idea if twist lock system can be put on the l10 for we were still selling the Deutz at that time. I do know we wanted to watch oil fill capacity on l10 also and did not add unless oil was down to add mark. This was to help prevent crankshaft from diping oil in a hard turn and likely on hills. Original owners of these machines got letter from Gleaner to contact Cummins and dealers should of made sure Cummins did there part but I know many machines get missed due to change of ownership ect. Maybe that is why I keep buging you on this.