For this code to work, there's some important things that needs to be followed. If you already finished the game, chances are, there are things you did that will cause this not to work. So most likely, if you finished the game already, this cheat won't work. And you'll see why in the below preparations in order for this to work.
Make sure you follow these instructions carefully. This code works for Red, Blue, and Yellow versions. Do NOT battle this trainer at Route 8 (near Saffron City) and Route 25 (near Bill's Place). If you do, the code will not work. You need to play the game from the start till the point where you get HM02 Fly from Celadon City. At that point, you can do this code. Also, make sure you have a Pokemon that knows fly with you while doing this code.
Go to Route 8, and stand in front of the door in the building shown above. Be careful, to move so that the trainer near the house can't see you. This would be a good time to save your game, because you can't save the game until you got your Mew, and you may mistakes, so this will leave you at a good point to start over.
When you take a step down, that trainer will see you. However, when you are taking that step down, quickly press start. If you did it right, then the menu should pop up first before the trainer can see you. If you didn't get it right, then you'll have to start over. Because you can't battle this trainer. Battling this trainer will ruin the code. Fly to Cerulean.
Now you're at Cerulean City, and go across the Nugget Bridge north of the city.
After going up the Nugget Bridge, go east towards Bill's House. You won't actually go to Bill's House, but along the way, you need to find the trainer seen above. This is very important: You have to make the trainer walk up to you. So don't go in front of the trainer, it will cause your game to freeze. Walk above the trainer, so that he has to walk over to get to you. Once he walks over, and meets you, then you'll have a battle, and you have to win. It shouldn't be a problem, the only Pokemon he has is a Slowpoke at level 17. After you won the battle, fly to Lavender Town.
Ok, you're almost there. At Lavender Town, go to the path seen above. Take one step towards a path, and the menu will automatically pop up. Exit the menu and you will immediately encounter Mew. Mew is only at level 7, and only knows Pound. So it shouldn't be hard to capture.
ALL INFO FROM pe2k. com