Dolores is an unreliable narrator and the gun is actually there but she just doesn't see it. She sort of glitches into years of a reinforced loop where there is no gun.
She also glitches into seeing the repeated loop of her being shot in her stomach before it actually happens, and is able to avoid that scenario. These eperiences make her go all wonky and stumble off the ranch and into Williams camp.
When she is listening and having converstations with a voice in her head she also blanks out he surroundings, thus william and Logan disappearing from the frame in the graveyard and william asking if she was talking to herself, and also her being alone in the train.
An alt timeline theory for the above is way more convoluted and betrays the actual sequence of scenes shown to the audience.
The gun triggers a memory of the MiB, presumably from the first episode. She shouldn't be able to remember this. We don't know the significance of his "start at the beginning" line yet. It probably has to do with what Arnold planted in her back in the early days ("beginning") of the park.
Dolores has not fully awoken yet, so her "normal" programming takes over at this point and she cannot see the gun any more. It's an object that shouldn't be there, so her programming glosses over it. She goes about her day.
See to me all of this is unfounded(which I assume everyone anti-theory thinks the same of that). We've never seen the Hosts unable to see objects that they shouldn't, all we've seen is them remembering things from past 'loops' and hearing voices. Whenever their memories have come back and they get all confused they've been shown to have no programming safeguards in place, they all just experience it. To the point that Maeve is aware there is a bullet in her and goes about getting it out.
Her dad saw that photograph, Maeve has her drawings, neither of them were stopped from seeing them by some type of programming. And only when they are 'reset' do they lose their memories but Dolores finds the gun in her dresser and then
immediately blanks it out? Nothing like that has happened before.
I'm also 99% sure there isn't a flashback to mib right when she opens the drawer and the gun is there. It was just like a quick auto correct, I remember rewinding that scene because I was like where did the gun go, and I don't remember a flashback to mib right there. What episode was that?
There is, near the beginning of episode 3.
This is the first time we see the gun after she initially digs it up. The gun still has some dirt on it (it's not "old and rusty").
That gun is definitely way more weathered than just being covered in dirt.
It seems super obvious(there's that word again) that Dolores' trip with William will end with her coming home and burying her gun just for her future self to find it later.
I think we all agree that Dolores' perception is screwed up, and that she does sporadically "flash back" to prior events (i.e. The Church). But these flashbacks are just that - flashes. She's only able to access past memories very briefly and in fragments, and when she does it leaves her visibly shaken and confused. It doesn't make sense that she would be able to remember a sustained sequence of events like her adventure with William.
I think it makes perfect sense as she finally overcomes one aspect of programming, namely going from being unable to defend herself(Teddy tries to teach her to shoot but she can't pull the trigger) to being able to do just that in the barn.
When she is "zoned out" before entering Pariah the voice in her head says "Find me." and she says "Show me how.", she is then in her memories showing her the next leg of her journey with William in Pariah. She is tracing her own footsteps back to that church and, presumably, what happened 30 years ago.