In this study, the density functional theory (DFT) is used to investigate the effects of passivating line sulfur vacancies by non-metal species (C, N, O, F, OH and NH2) in armchair MoS2 nanoribbon (AMoS2NR) on its structural, electrical and optical properties. Calculated binding energies show that passivation of line vacancies by oxygen atoms leads to the most stable structures. Electronic calculations show that presence of single line vacancies decreases the bandgap of 0.68 eV in perfect AMoS2NR to 0.62 eV in single line vacant AMoS2NR (SV) and substituting the vacancies with carbon and oxygen (C-SV and O-SV) returns the bandgap to its initial value. It is also shown that passivation of SV with NH2 leads to a semiconductor with a small bandgap of 0.08 eV. However, substituting the vacancies of SV with N, F and OH results in metallic structures. In the case of double line vacant AMoS2NR (DV), the bandgap reduces significantly (0.38 eV) with respect to its perfect counterpart. Similar to what happened in SV, passivating DV with C and O again increases the bandgap to the bandgap of the perfect structure. Furthermore, N-, F-, OH- and NH2-DV show metallic behavior. In addition, we use total, projected and local density of states (TDOS, PDOS and LDOS) analysis to reveal the role of different atoms in different positions on the electronic properties of defective AMoS2NRs. In order to investigate the effect of passivation on the optical properties of defective AMoS2NRs we present the real and imaginary parts of dielectric function spectra. Our results suggest that passivation of line vacancies by different atoms can efficiently tune the absorption of AMoS2NR and open a new path to obtain MoS2-based optoelectronic devices.