Interstellar extinction in ultraviolet is the most severe in comparison with optical and infrared wavebands and a precise determination plays an important role in correctly recovering the ultraviolet brightness and colors of objects. By finding the observed bluest colors at given effective temperature and metallicity range of dwarf stars, stellar intrinsic colors, $C^0_{rm B,V}$, $C^0_{rm NUV,B}$, $C^0_{rm FUV,B}$ and $C^0_{rm FUV,NUV}$, are derived according to the stellar parameters from the LAMOST spectroscopic survey and photometric results from the $GALEX$ and APASS surveys. With the derived intrinsic colors, the ultraviolet color excesses are calculated for about 25,000 A- and F-type dwarf stars. Analysis of the color excess ratios yields the extinction law related to the $GALEX$ UV bands: $E_{{rm NUV,B}}$/$E_{{rm B,V}} = 3.77$, $E_{{rm FUV,B}}$/$E_{{rm B,V}} = 3.39$, $E_{{rm FUV,NUV}}$/$E_{{rm B,V}} = -0.38$. The results agree very well with previous works in the $NUV$ band and in general with the extinction curve derived by Fitzpatrick (1999) for $R_{rm V}=3.35$.