No, social workers can neither diagnose a mental illness nor prescribe medication for one.
Family doctors, psychologists, and psychiatrists can all diagnose an individual with a mental illness. However, only family doctors and psychiatrists are able to prescribe medication. Since psychiatrists specialize in mental illness, family doctors will often refer patients to them for further support.