I am currently experimenting with a version of Ascari/Sbordone (2014): “The Macroeconomics of Trend Inflation” trying to incorporate a rule that allows for average inflation targeting: e.g. over the last 10 periods the average inflation rate must be 2%, if it deviates, adjust the nominal interest rate. Is it possible to use the optimal simple rules command (osr) to model such behaviour? If yes, how could I approach this technically and if not, which approach would be better?

Suppose time in your model is a quarter, as it usually is.
Quarterly inflation is the defined as the time difference in the log of the price level, such that simply \pi_t=p_t - p_{t-1}. By the same token, annual (4-quarter) inflation is \pi^{(4)}_t=p_t - p_{t-4}.
Now, suppose you would like to have a 3-year averaging window.
The 3-year (12-quarter) average inflation rate (at an annual rate) in quarter t, \bar{\pi}^{(12)}_t is defined as \bar{\pi}^{(12)}_t=\frac{p_t - p_{t-12}}{3}.

You could implement the definitions in the code by writing

With such definitions in mind, you can write the Taylor rule along the lines
of \left(\ldots\left(\frac{\bar{\pi}^{(12)}_t}{\bar{\pi}^{\star}}\right)^{\phi_\pi} \right)^{1-\phi_r}, where the dots denote any other term you may want to include in your Taylor rule and \pi^{\star} is your objective for the 3-year average inflation rate (at annual rate), say 2%.
In the code you could write it as

dear cmarch,this setup results in the logarithm of the price in the DSEG model. What do we do with the steady state and the initial value of the price log?

If your model is log-linearised, the variable plevel is in log deviations from the steady state, so in steady state it is zero. If the model is nonlinear, you can normalise the price level to unity in the steady state, such that the level of the log price level in steady state is zero.