The D7 Chord is made up of 4 notes from the D Major Scale.
The notes included in the chord are the Root (D), The Major 3rd (F#), The Perfect 5th (B) and the Dominant 7th (which we typically use a minor 7th or C instead of C#).
This diagram shows you exactly how to place your fingers on a guitar fret board in order to play the chord perfectly in it’s most basic form. There are also alternate ways to play this chord, as shown in the alternate D7 voicings on this page.
Here is a great instructional video which show you the exact fingering to play the chord perfectly.