The image is a part of Bach's chorale BWV 94.8 or R. 291 (image taken from www.bach-chorales.com). I want to confirm the harmony of the 2 chords marked with a star. Is the chord with a blue star A7/C# with the D as an accented passing note? And the chord with the orange star, Dsus E (or Dsus2, Dsus9 as some call it, if I am not wrong)?
You are correct for the first chord. It's a A7 in first inversion (A7/C#) or the V6 5 in your Dmajor scale. The D in the bass is a accented passing tone, like you mentioned.
The second chord is simply a D major chord with a E as a suspended note (because it was played in the previous chord) or appogiatura (because it was not held); either way, it's a non-chord tone that resolves to the chord note D. It's pretty common in Bach after the V chord to play the I, and that is what is happening here.
Bach didn't use sus2 chords per se. He might use like he did in this example, were the 2 was just a non-chord tone that is resolved in the chord note, so don't go looking for sus chords in Bach's chorales.