Restart your game and play until you get HM02 Fly from the house west of Celadon City.
DO NOT fight the following trainers:
The Youngster with a Slowpoke (Level 17) on the road to Bill's house (Route 25). He is the fourth trainer after you cross Nugget Bridge, standing directly above a female trainer and facing north.
The Gambler with two Poliwags and a Poliwhirl (all Level 22) between Lavender Town and Saffron City (Route 8). He is standing just east of the entrance to Saffron City, facing north toward the door of the Underground Path.
Carefully follow the illustrated steps below.
Make sure you have a Pokémon that knows Fly. On Route 8, stand in front of the door of the Underground Path. Save your game, since saving after this point will disrupt the procedure.
Walk down one step and immediately press Start. If you succeed, the menu will pop up before the Gambler "sees" you. Go to the Pokémon list and fly to Cerulean City.
The Gambler will see you just before you fly away.
Your Start button will no longer function. Go north across Nugget Bridge and head east until you find the trainer in this picture (he's the Youngster described above).
If you walk right up to the Youngster, the game will lock up, so you'll have to let him see you and walk up to you. Defeat his Slowpoke (afterwards, your Start button will work again), then fly to Lavender Town.
Head west into Route 8.
As soon as you enter the narrow path, the menu will pop up by itself. Press B to exit...
...and look who it is! Mew will be at Level 7 and its only attack will be Pound. Pokéball, go!
Once you've caught Mew, you can save your game without any ill-effects.
There are two alternative ways to enter Route 8 and trigger Mew after beating the Youngster. If you have access to Saffron City, you can fly there and go through the eastern city gate. Also, you can fly to Celadon City, head east to Route 7, enter the Underground Path, and emerge back in front of the Gambler.
Finally, the Route 8 Gambler isn't the only trainer that can initiate the trick. The Super Nerd just west of him can also do it, as can the second Fisherman you meet when heading south from Lavender on Route 12. There are numerous others; basically, any trainer who is scrolled onto the screen by the same step that puts you in their vision range will work. However, remember that the final battle with Mew will only be triggered by returning to whatever route that trainer is in, which is not necessarily Route 8.
Thanks to TheScythe from the GameFAQs message boards for the information on how to do this.
How the Mew Trick Works
When you use Fly to get away from the Gambler, the game somehow "remembers" that a battle is supposed to be taking place on Route 8. This is what causes your Start button to stop working. The rest of the trick hinges on a twelve-byte section of memory, starting at memory location CD22 in Yellow (CD23 in Red/Blue), which contains the stats of the last Pokémon you fought. After you battle the Youngster, it will have these hexadecimal values:
8E 11 00 3C 00 1E 00 1D 00 1C 00 15
The first byte (8E) seems to be the same for all battles.
The second byte (11) is the enemy's level (17 in decimal).
The next ten bytes are the enemy's stats (HP/Attack/Defense/Speed/Special). Each stat takes up two bytes.
Additionally, this section of memory is surrounded by eight bytes on each side, which all have the value 07.
The last byte (15) in Yellow memory location CD2D (CD2E in Red/Blue) is the important one. It is the "least significant byte" of the enemy Pokémon's Special stat; in this case, it means that the enemy has a Special of 21 in standard decimal notation.
When you return to Route 8, the game tries to resume the battle that was interrupted before. For reasons unknown, it borrows byte CD2D to use as the species identifier for the enemy Pokémon, and the next byte to use as its level. If the last battle you fought was with the Youngster, these bytes will be 15 and 07. Since Mew's hexadecimal identifier is 15, you will fight a Level 7 Mew.