Which kind of distributor? Is there a switch that does ignition timing, or just the distribution part, which sends the juice to the correct sparkplug?
If the former, you’re good. If the latter, you have some nontrivial work to do.
In order to answer the question, we’d need to know more about the engine. List all the sensors and actuators and we can give you a better idea.
I worked on engine control at Ford Scientific Research Lab in Dearborn, and learned a lot about it. One of the simplest aspects in theory is scheduling spark, but it’s trickier than you might think. For example, the coil has to be charging for at least 1.5 ms to deliver a spark, but must not be allowed to charge for more than say 4 ms or you’ll burn it out. (Those numbers are from memory from 1978 and are subject to significant error!) Hopefully you already know that the spark happens when the coil is turned off. (If not, chances are slim you’ll have a clue about the rest of the stuff.)
Unless you have a good resource for a “strategy” (the set of equations relating the inputs to the outputs) you have quite a bit of work to do before you even begin at the part where my expertise begins, which is how to code it.
The simplest strategy I remember was a single handwritten page with about a dozen equations, some of them fairly long. That was for an 8-cylinder pickup. The number of cylinders doesn’t affect the math or coding much. I transformed that into a Pascal (variant) program that ran the truck. I don’t remember how long that program was, but I’d guess it was on the order of 50K characters. Most of the code revolved around scheduling. One complication was that it used fixed point arithmetic; today you’d use floating point and save a lot of trouble.
I wonder whether an Arduino could handle it. At 5000 RPM on a 4-banger, that’s only about 1600 spark and fuel events per second. The trick is spark timing, which has to be accurate to about a degree of crank angle. That’s 1/30,000 sec, or 33 microseconds, at 5000 RPM. Using much cruder hardware we got higher accuracy, but special-purpose hardware and a bit of software engineering went into it.
BTW, you don’t need a “crankshaft position” sensor as much as a “top dead center” signal. Back in the day, they used hall effect sensors for TDC.