What Size Toilet Flange for 3 1/2" ABS Pipe?
The outside diameter is more important with PVC pipe because that's how the fittings attach.  For instance, DWV (drain) pipe and SCH40 pipe have way different wall thicknesses (so different inside diameters) but the same outside diameter.  

That said, you have a 3" pipe there, and should get a flange made for 3" pipe.  What you will typically find will be a "3x4 toilet flange" that will fit over a 3" pipe (flange has a 3.5" inside diameter) or into a 4" pipe.

You may have purchased a flange made to go into a 3" fitting previously.

Your comments indicate this is a concrete slab, and you can't connect around the 3" ABS pipe, so a 4x3 flange won't work as it sits.  You have two options in that case.

The easiest is to get a flange designed to fit inside ABS pipe specifically, like the Sioux Chief 888-A.  This is simple, but some people scoff at the push-to-fit flanges as unprofessional.

The other option is to chip out concrete around the pipe and use a standard 4x3 flange with a stainless steel ring.  This will securely glue to the pipe and be more like what a plumber would have done if they were installing the toilet from new.