This looks like a generalization of the classic $12$ ball problem.
You should be able to modify Jack Wert's wonderful algorithm, (which was designed for the case when $N= \dfrac{3^m - 3}{2}$) to work for any $N$. I believe I had made an (incomplete) attempt when someone asked this on stackoverflow.
Note that the numbers $\dfrac{3^m - 3}{2}$ are special, in the sense that they are the turning points.
In the variant of the problem where you are also required to tell if the odd sphere is heavier or lighter, for $\dfrac{3^m -3}{2} \lt N \le \dfrac{3^{m+1}-1}{2}$, the optimal number of weighings can be shown to be $m+1$.
If you are only required to find the odd sphere and not necessarily figure out if it is heavier or lighter, the turning points are $\dfrac{3^m -3}{2} + 1$.
The way to solve problems of this sort is to think about how much information you have, which is equivalent to how few possibilities remain.
Each weighing can have one of three possible outcomes: the left pan is heavier, ther right pan is heavier, or they weigh the same. You want each outcome to correspond to (roughly) the same number of remaining possibilities.
Initially, you have 26 or 27 possibilities: one item is heavier (and there are 13 choices for which that item that is), one item is lighter (out of 13), or maybe they're all the same. Since 27 = 3 * 3 * 3, you might hope that three weighings will suffice even if it's possible that they're all the same.
But for that to happen, the first weighing has to split the possibilities into three sets of exactly 9 each.
If on the first weighing you weigh 4 items against 4 others, the split is:
Left pan is heavier means one item in the left pan is heavier or one item in the right pan is lighter. That's 8 possibilities.
Right pan is heavier means one item in the left pan is lighter or one item in the right pan is heavier. Again 8 possibilities.
The pans balance. This must cover the 10 or 11 remaining possibilities. We cannot resolve these in only two more weighings. (Two weighings can have only 3 * 3 = 9 outcomes.)
So, four against four won't work. What about 5 against 5? This splits the 26 or 27 possibilities into sets of size 10, 10, and 6 or 7. Again, we cannot answer the question in only 2 more weighings.
More than 4 in each pan on the first weighing leaves too many possibilities for when the scales do not balance. Fewer than 5 leaves too many possibilities when they do balance.
The problem cannot be solved in only three weighings, even if you know there is an odd item. (Unless you know something else, like the color of the odd item, or that the odd item has a different density and there is some water we can immerse the apparatus in, or we can tie them together bolo-fashion, spin them, and observe how the center of mass moves. Or the scale has more than two pans.)
UPDATE: I just realized you only need to identify the odd item, not whether it's heavy or light. That means you start with only 13 possibilities. I'll be back.
I'M BACK...
Ignore the 13th item. In three weighings, you can tell if one of 12 items is odd, and if so whether it's light or heavy. I won't re-iterate this well-known solution. Re-interpret the "none of the 12 is odd" as "the so-far-ignored 13th item is odd".
You lose the ability to tell that there is an odd item, and if the odd item is the 13th you lose the ability to tell if it's light or heavy, but if you can assume there is an odd item you can always tell which it is, and sometimes (read usually) tell whether it's heavy or light.
Best Answer
There are two possibilities for this answer which depend on two different sets of assumptions. The first is that this is strictly a theoretical math problem, similar but not identical to the trisection of an angle problem, whereby dividing a quantity of flour into two halves any number of times cannot result in three equal quantities. This also assumes that the flour is an infinitely divisible substance and not a finite number of discreet grains. A series of divisions $\frac{1}{2}, \frac{1}{4}, \frac{1}{8}......, \frac{1}{2^n}$ can never partially sum to $\frac{1}{3}$ for any finite number of divisions, as shown in the previous answer by TonyK.
The second assumes a more practical approach which considers the trial and error aspect of balancing two quantities of flour. It also allows for an imprecise division into two parts whereby individual grains of flour are not themselves divisible. Divide the flour roughly into $3$ equal piles A,B and C. Put A and B on the scale and adjust until they balance. Put A and C on the scale and adjust a lighter C with equal parts of A and B or equal division of excess C to A and B (both determined by removing quantities A and C and determining the equal adjustments with the balance) . Repeat until A and C balance. Then all $3$ will be equal within the accuracy of the balance beam. I certainly don't see this as impossible.