The following calculation answers your first question. It is not clear how to model price fluctuations precisely enough to answer the second question.
Suppose that the price per gallon in Week $1$ is $p_1$ dollars, and the price per gallon in Week $2$ is $p_2$ dollars.
Let's examine first the case where we buy $X$ gallons in Week $1$, followed by $X$ gallons in Week $2$, what you have called the fixed number of gallons. Then we have spent a total amount $p_1X+p_2X$ for $2X$ gallons, so the average cost per gallon is $\frac{p_1X+p_2X}{2X}$ which simplifies to $\frac{p_1+p_2}{2}.$
The above result didn't really require such a detailed calculation. I was getting into shape for the next calculation, which is harder!
Suppose that we spend $D$ dollars in Week $1$, and $D$ dollars in Week $2$. How many gallons have we bought? It may be useful to write down explicitly the relationship between "unit cost" $p$ (price per gallon), total cost $d$, and amount bought $x$. We have in general $px=d.$ This can be rewritten as $x=\frac{d}{p}.$
If we spent $D$ dollars in Week $1$, and the price was $p_1$, we bought $D/p_1$ gallons. Similarly, in Week $2$ we bought $D/p_2$ gallons. So the total amount we bought is $\frac{D}{p_1}+\frac{D}{p_2},$ and the total cost was $2D$, so the average price per gallon was $\frac{2D}{\frac{D}{p_1}+\frac{D}{p_2}}.$ With some algebraic manipulation, this simplifies to $\frac{2p_1p_2}{p_1+p_2}.$
Terminology: The number $(p_1+p_2)/2$ is called the Arithmetic Mean of $p_1$ and $p_2$. The number $2p_1p_2/(p_1+p_2)$ is called the Harmonic Mean of $p_1$ and $p_2$.
It turns out that the arithmetic mean of two positive quantities is always at least as large as the harmonic mean. Here is a proof. We want to show that $\frac{p_1+p_2}{2} \ge \frac{2p_1p_2}{p_1+p_2}.$ This is equivalent to showing that $(p_1+p_2)^2 \ge 4p_1p_2.$ Expand the square, move things around. We want to show that $p_1^2-2p_1p_2+p_2^2\ge 0.$ But this is obvious, since $p_1^2-2p_1p_2+p_2^2=(p_1-p_2)^2$, and any square is $\ge 0$.
Conclusion: Fixed dollar amount is never more expensive per gallon than fixed number of gallons. And fixed dollar amount always gives a lower cost per gallon, if prices change.
Your first question contemplated only two strategies. Things get much more complicated if we have some knowledge about the likely price fluctuations. But if we have such prior knowledge, we can get rich, and let the chauffeur worry about filling the tank.