It depends on how bad the infection and fluid/pressure build up is.
It also depends on whether or not the airplane is pressurized, and how high you go.
Assuming you are like normal people (and not me), I’ll assume you’re talking about a commercial passenger jet, in which the pressure varies from sea level (when sitting on the ground at sea level) to the equivalent of 8,000 feet altitude.
Now that that is out of the way - if you’re ear is hurting on the ground it is guaranteed to hurt worse with pressure changes. There are several possibilities.
Your eustachian tube is not completely blocked, so the pressure can equalize - eventually. You still be subjected to occassional stabs of pain.
When the pressure in your ear is higher than ambient - such as on the way up - the extra air pressure might open the e-tube sufficiently to alleviate pain on the way up… but maybe not on the way down. So you’ll have a lower pressure inside the ear as the external pressure goes up. This will bear down on your eardrums. It will be excruiciating. It may even lead to alternative #4, below
You e-tube may be so blocked pressure can’t equalize. In which case, your pain will increase as you go up, level out at cruise along with the airplane’s altitude, then subside as you go down. Assuming both arrival and destination are at roughly equivalent altitudes, you should be left with the same pain you started with.
In extreme cases, your eardrum can rupture. Really. On the way up, if internal pressure exceeds your eardrum’s structural limits you’ll have a blow-out. The good thing is that this will immediately result in a dimishing of pain. The bad things are the nasty, infected goo that will drain out of your ear - this is sure to freak out someone, if not several people - and the necessity of seeing a doctor. It is much less likely, but it’s also possible that if external pressure is much higher than internal the eardrum could also rupture. In some cases the eardrum will heal on its own with only neglible hearing loss, but surgery may be required and permanent hearing loss can occur.
In light of the above, I strongly suggest you seek out a doctor. If you start antiobiotics and a good decongestant you may be able to complete your trip with something less than howling agony.
This may also be an instance where the wisest course is not to fly. Unless you don’t care about jeopardizing your hearing.
But it would take a doctor evaluating you in real life to make that sort of determination.