I have created a "GeoStatistical Analyst Layer" with "Diffusion Interpolation with Barriers" tool and then I published it on the ArcGIS for Server.
How can I show this layer in my web map application using Javascript API?
In the list of layer types that dynamic map service supports, there is also support for Geostatistical layer. Which means you can access your dynamic map service that contains a Geostatistical layer without any extra processing.
Since you are on Esri JS API for ArcGIS, you would need to look for the sample that just draws a dynamic map service such as this. You basically need to declare a variable
var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer"
and point it to the MapServer REST endpoint of your service published which follows the notation http://%machinename%:6080/ArcGIS/rest/services/servicename/MapServer
. You can find out what services you have and the URLs they have via a special application installed with ArcGIS for Server called Services Directory. You can access this application at http://%machinename%:6080/ArcGIS/rest/services
.