Hello Don. Actually, Lionel O gauge engines run on ac OR dc. Most if not all postwar ran on AC as you would have to disconnect the whistle or horn if you ran on DC; but you COULD run them on DC.
Your engine has some other problem if it won't work. Better to replace it if you can. It was a low end engine in the cheapest sets.