Merc used several different engines in these boats. As you have found out. The 4 pulleys on top are the clues. 3 of the pulleys are obvious. The 4th (with the large smooth top pulley) is the air compressor. I think there were 2 Optimax options. A 200hp (don't know the displacement) and a 3.0 liter 250 hp. By appearance, you have the smaller engine.
Start diagnostics with a compression test. All plugs out. WOT. NOT in the water.
Check fuel and air pressure. Check spark x6.
This is more fun than telling the difference between small block Chevy's.
The possibility of a cobbled together engine.
That's marvelous but not surprising.
Given your engine delima I'd do some diagnostics on the rpm problem and hope any parts that need replacing have part numbers on them. Or are reasonably generic that they fit many model powerheads.
Tim's suggestions are valid but you should perform a basic tune up and inspection along side it.
I hope you're handy with a wrench. Some engine knowledge and skills will help too.
Filters and plugs. You may have 3 fuel filters in line here.
Mercury marine has way too many diagrams on filter location. Will require some research but pik one that looks like yours and trace from there.
Other folk may help with filter locations in here.
Plugs should be tan color not oily black. Lotsa charts online for comparison.
See if they are the plugs recommended on the emmission tag.
This could be a clue to engine genre.
New plugs may be needed. Go with what's in there now.
Don't forget to gap them. My 2005 240 hp optimax calls for a .032 gap. Your tag says .043. Check the gap on your plugs currently in it and go with that unless it's well over .043 then I'd go with .043.
This would be time to do a compression test. Screw in testers are cheap and the info valuable to diagnostics. Follow the directions. All plugs should be out for this test.
If you have access to a scope have a look in the plug hole at the pistons heads and sleeve walls for scratches and unusual wear.
replace the Water separator. Thats the thing that looks like a oil filter on one side. It should have a part # on it. Check before taking it off in case it gets rubbed off.
general inspection of wires and wire connections. Look for crap and corrosion on wires and connections. Look for melted things maybe got too hot.
Section the engine and be precise and vigilant. You don't have to disconnect connections unless they look unusual and require a deeper look.
Check plug wires and boots for cracks and brittleness (not sure that's a dictionary word) boot should gently click onto the plug electrode and not be too easy to pull off or wiggle to much.
Check hoses for cracks and brittleness.
check the drive belt for cracks and wear.
Check belt tensioner. It needs to move but be tight enough to hold the belt firmly. Nothing more annoying than a slipping drive belt on these things.
Drain the gas tank if you can. Put new fuel in. Nothing screws up a good engine more then bad gas. If using pump gas (car gas) don't use low grade fuel with ethanol. It doesn't mix well with water if there's any in the fuel system. Marine gas from a marina usually has no ethanol in it. Many premium pump gas does not either. Check on the pump. It should say which grade has ethanol in it. E10 means 10% ethanol in the fuel product. Never use E85 or E15 fuel in a marine engine.
Other members will have suggestions for a good tune up. These are basics.
This will give you a good base line to work up from. It tends to be cheaper initially.
Then test after and move up from there.