A search for a narrow scalar resonance decaying into an opposite-sign muon pair produced in events with and without b-tagged jets is presented in this paper. The search uses 36.1 fb−1 of s=13 TeV proton-proton collision data recorded by the ATLAS experiment at the LHC. No significant excess of events above the expected Standard Model background is observed in the investigated mass range of 0.2 to 1.0 TeV. The observed upper limits at 95% confidence level on the cross section times branching ratio for b-quark associated production and gluon-gluon fusion are between 1.9 and 41 fb and 1.6 and 44 fb respectively, which is consistent with expectations.[Figure not available: see fulltext.].